Compare commits

...

3 Commits

Author SHA1 Message Date
bhe-talendbj
797c17a7ef fix(TUP-22426): Add new method 2020-07-08 17:29:01 +08:00
bhe-talendbj
4845e60aad fix(TUP-22426): Revert unnecessary changes 2020-07-08 16:54:04 +08:00
hwang-talend
b800dc4d05 bugfix(TUP-22426):[6.5.1]Test Case generation on tRunJob gives (#2398)
bugfix(TUP-22426):[6.5.1]Test Case generation on tRunJob gives compilation error "row1 cannot be resolved to a variable"

Conflicts:
	main/plugins/org.talend.core.runtime/src/main/java/org/talend/core/ui/ITestContainerProviderService.java
2020-07-08 16:45:58 +08:00
2 changed files with 45 additions and 26 deletions

View File

@@ -36,6 +36,7 @@ import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryEditorInput;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.repository.model.RepositoryNode;
@@ -130,4 +131,5 @@ public interface ITestContainerProviderService extends IService {
Set<ModuleNeeded> getAllJobTestcaseModules(ProcessItem item) throws PersistenceException;
public List<NodeType> getOriginalNodes(ProcessType process);
}

View File

@@ -2153,6 +2153,47 @@ public class ProcessorUtilities {
}
// trunjob component
EList<NodeType> nodes = ptype.getNode();
getSubjobInfo(nodes, ptype, parentJobInfo, jobInfos,firstChildOnly);
if (parentJobInfo.isTestContainer()
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService =
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
ITestContainerProviderService.class);
if (testContainerService != null) {
getSubjobInfo(testContainerService.getOriginalNodes(ptype), ptype, parentJobInfo, jobInfos,firstChildOnly);
}
}
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService =
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
ITestContainerProviderService.class);
if (testContainerService != null) {
List<ProcessItem> testsItems =
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
for (ProcessItem testItem : testsItems) {
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
if (testItem.getProcess() == null) {
testItem.setProcess(testProcess);
}
if (testProcess == null) {
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
continue;
}
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
jobInfo.setTestContainer(true);
jobInfos.add(jobInfo);
jobInfo.setFatherJobInfo(parentJobInfo);
}
}
}
return jobInfos;
}
private static Set<JobInfo> getSubjobInfo(List<NodeType> nodes, ProcessType ptype, JobInfo parentJobInfo, Set<JobInfo> jobInfos,
boolean firstChildOnly) {
String jobletPaletteType = null;
String frameWork = ptype.getFramework();
if (StringUtils.isBlank(frameWork)) {
@@ -2162,7 +2203,7 @@ public class ProcessorUtilities {
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
}
for (NodeType node : nodes) {
for (NodeType node : nodes) {
boolean activate = true;
// check if node is active at least.
for (Object o : node.getElementParameter()) {
@@ -2259,31 +2300,7 @@ public class ProcessorUtilities {
}
}
}
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService =
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
ITestContainerProviderService.class);
if (testContainerService != null) {
List<ProcessItem> testsItems =
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
for (ProcessItem testItem : testsItems) {
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
if (testItem.getProcess() == null) {
testItem.setProcess(testProcess);
}
if (testProcess == null) {
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
continue;
}
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
jobInfo.setTestContainer(true);
jobInfos.add(jobInfo);
jobInfo.setFatherJobInfo(parentJobInfo);
}
}
}
return jobInfos;
return jobInfos;
}
private static boolean isRouteletNode(NodeType node) {