Compare commits

..

6 Commits

Author SHA1 Message Date
Christophe Le Saec
451f25526a TDI-42230 remove SNAPSHOT 2019-07-04 09:58:46 +02:00
Christophe Le Saec
b4c77184f3 fix(TDI-42230) : custom lib on copy with version 2019-07-03 10:28:44 +02:00
Christophe Le Saec
4efe837b40 fix(TDI-42230) - put filecopy librarie directly in studio 2019-07-02 10:17:28 +02:00
Christophe Le Saec
2164c692d2 fix(TDI-42230) : use filecopy from nexus in studio 2019-06-28 16:56:38 +02:00
Christophe Le Saec
c1de5f5fc0 fix(TDI-42230) filecopy.jar removed from git 2019-06-28 09:53:57 +02:00
Christophe Le Saec
bd31878bcd fix(TDI-42230) : utilisation de la classe standard java.nio.Files 2019-06-27 17:17:23 +02:00
79 changed files with 730 additions and 2479 deletions

View File

@@ -11,6 +11,7 @@
<import feature="org.talend.tos.feature" version="0.0.0" match="greaterOrEqual"/>
</requires>
<plugin id="org.talend.designer.maven.tos" download-size="0" install-size="0" version="0.0.0" fragment="true"/>
<plugin id="org.talend.libraries.mdm.webservice.ce" download-size="0" install-size="0" version="0.0.0" fragment="true"/>
<plugin id="org.talend.presentation.onboarding" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.presentation.onboarding.nl" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.presentation.onboarding.resource" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

View File

@@ -55,6 +55,5 @@
<plugin id="org.talend.testutils" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.talend.updates.runtime.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.utils.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="org.talend.sdk.component.studio-integration.test" download-size="0" install-size="0" version="0.0.0" fragment="true" unpack="false"/>
<plugin id="test.all.test.suite" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
</feature>

View File

@@ -69,140 +69,145 @@ if(hasInput){
}
}
}
boolean hasValidInput = inputConn!=null;
if (hasValidInput) {
IMetadataTable metadata = null;
List<IMetadataTable> metadatas = node.getMetadataList();
boolean haveValidNodeMetadata = ((metadatas != null) && (metadatas.size() > 0) && (metadata = metadatas.get(0)) != null);
if (hasValidInput && haveValidNodeMetadata) {
List<IMetadataColumn> input_columnList = inputConn.getMetadataTable().getListColumns();
if(input_columnList == null) {
input_columnList = new ArrayList<IMetadataColumn>();
}
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
if (input_columnList!=null && !input_columnList.isEmpty()) {
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
}
<%
}
<%
}
}
%>
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
} // column
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
}
<%
}
} // column
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
}
}
}
} // property
} // propInfo
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
} // property
} // propInfo
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
}
}
}
} // canStart

View File

@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.talend.libraries</groupId>
<artifactId>talend-soap</artifactId>
<version>2.1-20190716</version>
<version>2.1-20190513</version>
<packaging>jar</packaging>
<name>talend-soap</name>

View File

@@ -124,9 +124,7 @@ public class SOAPUtil {
}
SOAPMessage message = messageFactory.createMessage();
MimeHeaders mimeHeaders = message.getMimeHeaders();
setSoapAction(version, soapAction, mimeHeaders);
mimeHeaders.setHeader("SOAPAction", soapAction);
if (basicAuth) {
addBasicAuthHeader(mimeHeaders, username, password);
}
@@ -265,8 +263,8 @@ public class SOAPUtil {
}
SOAPMessage message = messageFactory.createMessage();
MimeHeaders mimeHeaders = message.getMimeHeaders();
setSoapAction(version, soapAction, mimeHeaders);
SOAPPart soapPart = message.getSOAPPart();
mimeHeaders.setHeader("SOAPAction", soapAction);
SOAPPart soapPart = message.getSOAPPart();
String encoding = getEncoding(soapMessage);
@@ -293,20 +291,8 @@ public class SOAPUtil {
return null;
}
}
/* https://jira.talendforge.org/browse/TDI-42581 skip add SOAPAction directly to header v1.2 */
private void setSoapAction(String version, String soapAction, MimeHeaders mimeHeaders) {
if (SOAP12.equals(version)) {
// in soap version 1.2 param 'action' optional and should not be empty
if( soapAction != null && !soapAction.trim().isEmpty()) {
mimeHeaders.setHeader("Content-Type", "application/soap+xml; charset=utf-8; action=\"" + soapAction + "\"");
}
} else {
mimeHeaders.setHeader("SOAPAction", soapAction);
}
}
private String getEncoding(String text) {
private String getEncoding(String text) {
String result = Charset.defaultCharset().name();
if(text == null) {

View File

@@ -7,7 +7,7 @@
<groupId>org.talend.libraries</groupId>
<artifactId>talend-db-exasol</artifactId>
<version>2.1.3</version>
<version>2.1.2</version>
<packaging>jar</packaging>
<name>talend-db-exasol</name>

View File

@@ -94,11 +94,12 @@ public class EXABulkUtil {
private String createNumberFormat(Integer length, Integer precision, boolean hasGroups) {
if (length != null && length.intValue() > 0) {
StringBuilder sb = new StringBuilder();
for (int i = length - 1; i >= 0; i--) {
if(hasGroups && i < length - 1 && i > 0 && (i % 3 == 2)) {
sb.append("G");
}
sb.append("9");
int numGroups = (length.intValue() / 3) + 1;
for (int i = 0; i < numGroups; i++) {
if (i > 0 && hasGroups) {
sb.append("G");
}
sb.append("999");
}
if (precision != null && precision.intValue() > 0) {
sb.append("D");

View File

@@ -7,7 +7,6 @@
<FAMILIES>
<FAMILY>Databases/DB Specifics/Amazon/Redshift</FAMILY>
<FAMILY>Cloud/Amazon/Redshift</FAMILY>
</FAMILIES>
<DOCUMENTATION>

View File

@@ -24,14 +24,13 @@
String dataset = ElementParameterParser.getValue(node, "__DATASET__");
String table = ElementParameterParser.getValue(node, "__TABLE__");
String gsFile = ElementParameterParser.getValue(node, "__GS_FILE__");
boolean setFieldDelimiter = ElementParameterParser.getBooleanValue(node, "__SET_FIELD_DELIMITER__");
String fieldDelimiter = ElementParameterParser.getValue(node, "__FIELD_DELIMITER__");
String actionOnData = ElementParameterParser.getValue(node, "__ACTION_ON_DATA__");
boolean dieOnError = ElementParameterParser.getBooleanValue(node, "__DIE_ON_ERROR__");
boolean createTableIfNotExist = ElementParameterParser.getBooleanValue(node, "__CREATE_TABLE_IF_NOT_EXIST__");
String gsFileHeader = ElementParameterParser.getValue(node, "__GS_FILE_HEADER__");
boolean dieOnError = "true".equals(ElementParameterParser.getValue(node, "__DIE_ON_ERROR__"));
String tokenFile = ElementParameterParser.getValue(node,"__TOKEN_NAME__");
boolean isLog4jEnabled = ElementParameterParser.getBooleanValue(node.getProcess(), "__LOG4J_ACTIVATE__");
boolean isLog4jEnabled = ("true").equals(ElementParameterParser.getValue(node.getProcess(), "__LOG4J_ACTIVATE__"));
String passwordFieldName = "";
@@ -202,7 +201,7 @@
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
}
boolean bulkFileAlreadyExists = ElementParameterParser.getBooleanValue(node, "__BULK_FILE_ALREADY_EXIST__");
boolean bulkFileAlreadyExists = "true".equals(ElementParameterParser.getValue(node, "__BULK_FILE_ALREADY_EXIST__"));
String accessKey = ElementParameterParser.getValue(node, "__GS_ACCESS_KEY__");
String secretKey = ElementParameterParser.getValue(node, "__GS_SECRET_KEY__");
String localFilename = ElementParameterParser.getValue(node, "__GS_LOCAL_FILE__");
@@ -235,7 +234,6 @@
}
%>
gsService_<%=cid%>.putObject(<%=bucketName%>, fileObject_<%=cid%>);
/* ----END-UPLOADING-FILE---- */
<%
if(isLog4jEnabled){
%>
@@ -244,6 +242,7 @@
}
}
%>
/* ----END-UPLOADING-FILE---- */
<%
if (authMode.equals("OAUTH")) {
@@ -259,76 +258,78 @@
com.google.api.services.bigquery.model.JobConfiguration config_<%=cid%> = new com.google.api.services.bigquery.model.JobConfiguration();
com.google.api.services.bigquery.model.JobConfigurationLoad queryLoad_<%=cid%> = new com.google.api.services.bigquery.model.JobConfigurationLoad();
<%if (createTableIfNotExist) { %>
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "float";
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Character".equals(column.getTalendType())) {
typeToGenerate = "string";
} else if("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "numeric";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "date";
}else if(pattern.length() > 12){
typeToGenerate = "timestamp";
}else{
typeToGenerate = "string";
}
}
String modeType = (!column.isNullable()) ? "REQUIRED" : "NULLABLE";
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
<%
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "float";
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Character".equals(column.getTalendType())) {
typeToGenerate = "string";
} else if("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "numeric";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "date";
}else if(pattern.length() > 12){
typeToGenerate = "timestamp";
}else{
typeToGenerate = "string";
}
}
%>
<%
String modeType = null;
if (!column.isNullable()) {
modeType = "REQUIRED";
} else {
modeType = "NULLABLE";
}
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
<%
}
}
}
%>
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
<%
}
if(createTableIfNotExist) {
%>
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
<%
if("true".equals(ElementParameterParser.getValue(node, "__CREATE_TABLE_IF_NOT_EXIST__"))) {
%>
queryLoad_<%=cid%>.setCreateDisposition("CREATE_IF_NEEDED");
<%
@@ -337,13 +338,15 @@
queryLoad_<%=cid%>.setCreateDisposition("CREATE_NEVER");
<%
}
if(setFieldDelimiter) {
if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
queryLoad_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
<%
}
%>
queryLoad_<%=cid%>.setAllowQuotedNewlines(true);
queryLoad_<%=cid%>.setWriteDisposition("WRITE_<%=actionOnData%>");
com.google.api.services.bigquery.model.TableReference destinationTable_<%=cid%> = new com.google.api.services.bigquery.model.TableReference();
destinationTable_<%=cid%>.setProjectId(PROJECT_ID_<%=cid%>);
@@ -351,8 +354,8 @@
destinationTable_<%=cid%>.setTableId(<%=table%>);
queryLoad_<%=cid%>.setDestinationTable(destinationTable_<%=cid%>);
queryLoad_<%=cid%>.setSourceUris(java.util.Arrays.asList(<%=gsFile%>));
queryLoad_<%=cid%>.setSkipLeadingRows(<%=gsFileHeader%>);
queryLoad_<%=cid%>.setSourceUris(java.util.Arrays.asList(<%=ElementParameterParser.getValue(node, "__GS_FILE__")%>));
queryLoad_<%=cid%>.setSkipLeadingRows(<%=ElementParameterParser.getValue(node, "__GS_FILE_HEADER__")%>);
queryLoad_<%=cid%>.setNullMarker("\\N");
config_<%=cid%>.setLoad(queryLoad_<%=cid%>);
@@ -458,10 +461,7 @@
com.google.cloud.bigquery.TableId tableId_<%=cid%> = com.google.cloud.bigquery.TableId.of(<%=projectId%>, <%=dataset%>, <%=table%>);
com.google.cloud.bigquery.Table table_<%=cid%> = bigquery_<%=cid%>.getTable(tableId_<%=cid%>);
com.google.cloud.bigquery.LoadJobConfiguration.Builder loadJobBuilder_<%=cid%> = com.google.cloud.bigquery.LoadJobConfiguration.newBuilder(tableId_<%=cid%>, <%=gsFile%>);
boolean dropTable_<%=cid%> = <%=ElementParameterParser.getBooleanValue(node, "__DROP__")%>;
if ( dropTable_<%=cid%> && table_<%=cid%> != null) {
if (<%=ElementParameterParser.getBooleanValue(node, "__DROP__")%> && table_<%=cid%> != null) {
boolean deleted = bigquery_<%=cid%>.delete(tableId_<%=cid%>);
if (deleted) {
<%
@@ -475,66 +475,69 @@
throw new RuntimeException("Unable to delete table " + tableId_<%=cid%>);
}
}
<%if(createTableIfNotExist){%>
if(table_<%=cid%> == null){
java.util.List<com.google.cloud.bigquery.Field> fields_<%=cid%> = new java.util.ArrayList<>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
if("id_String".equals(column.getTalendType()) || "id_Character".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
} else if ("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.FLOAT";
} else if ("id_Short".equals(column.getTalendType()) || "id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.INTEGER";
} else if ("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.NUMERIC";
} else if ("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.BOOLEAN";
} else if ("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.DATE";
}else if(pattern.length() > 12){
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.TIMESTAMP";
}else{
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
}
}
String modeType = (!column.isNullable()) ? "REQUIRED" : "NULLABLE";
if (<%=ElementParameterParser.getBooleanValue(node, "__DROP__")%> || <%=ElementParameterParser.getBooleanValue(node, "__CREATE_TABLE_IF_NOT_EXIST__")%>) {
java.util.List<com.google.cloud.bigquery.Field> fields_<%=cid%> = new java.util.ArrayList<>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
if("id_String".equals(column.getTalendType()) || "id_Character".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
} else if ("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.FLOAT";
} else if ("id_Short".equals(column.getTalendType()) || "id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.INTEGER";
} else if ("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.NUMERIC";
} else if ("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.BOOLEAN";
} else if ("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.DATE";
}else if(pattern.length() > 12){
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.TIMESTAMP";
}else{
typeToGenerate = "com.google.cloud.bigquery.LegacySQLTypeName.STRING";
}
}
String modeType = "NULLABLE";
if (!column.isNullable()) {
modeType = "REQUIRED";
}
%>
com.google.cloud.bigquery.Field field_<%=i%> = com.google.cloud.bigquery.Field.newBuilder("<%=columnName%>", <%=typeToGenerate%>)
.setMode(com.google.cloud.bigquery.Field.Mode.valueOf("<%=modeType%>"))
.build();
fields_<%=cid%>.add(field_<%=i%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\"}");
<%
}
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\"}");
<%
}
}
}
%>
com.google.cloud.bigquery.Schema schema_<%=cid%> = com.google.cloud.bigquery.Schema.of(fields_<%=cid%>);
com.google.cloud.bigquery.TableInfo tableInfo_<%=cid%> = com.google.cloud.bigquery.TableInfo.newBuilder(tableId_<%=cid%>, com.google.cloud.bigquery.StandardTableDefinition.of(schema_<%=cid%>)).build();
table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
loadJobBuilder_<%=cid%>.setSchema(schema_<%=cid%>);
}
<%}
if(createTableIfNotExist) {
%>
com.google.cloud.bigquery.Schema schema_<%=cid%> = com.google.cloud.bigquery.Schema.of(fields_<%=cid%>);
com.google.cloud.bigquery.TableInfo tableInfo_<%=cid%> = com.google.cloud.bigquery.TableInfo.newBuilder(tableId_<%=cid%>, com.google.cloud.bigquery.StandardTableDefinition.of(schema_<%=cid%>)).build();
table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
loadJobBuilder_<%=cid%>.setSchema(schema_<%=cid%>);
}
<%
if("true".equals(ElementParameterParser.getValue(node, "__CREATE_TABLE_IF_NOT_EXIST__"))) {
%>
loadJobBuilder_<%=cid%>.setCreateDisposition(com.google.cloud.bigquery.JobInfo.CreateDisposition.CREATE_IF_NEEDED);
<%
@@ -544,35 +547,51 @@
<%
}
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_<%=actionOnData%>);
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
csvOptions_<%=cid%>.setAllowQuotedNewLines(true);
csvOptions_<%=cid%>.setSkipLeadingRows(<%=gsFileHeader%>);
<%if(setFieldDelimiter) {
%>
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>).build());
<%
}
%>
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(loadJobBuilder_<%=cid%>.build()));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)));
if (job_<%=cid%> != null && job_<%=cid%>.getStatus().getError() == null) {
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Job execution status: " + job_<%=cid%>.getStatus());
<%
}
%>
} else {
List<com.google.cloud.bigquery.BigQueryError> errorList = job_<%=cid%>.getStatus().getExecutionErrors();
throw new RuntimeException("Job failed: " + errorList.get(errorList.size() - 1));
<%
if("APPEND".equals(actionOnData)) {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_APPEND);
<%
} else if("TRUNCATE".equals(actionOnData)) {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_TRUNCATE);
<%
}
else {
%>
loadJobBuilder_<%=cid%>.setWriteDisposition(com.google.cloud.bigquery.JobInfo.WriteDisposition.WRITE_EMPTY);
<%
}
%>
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
csvOptions_<%=cid%>.setAllowQuotedNewLines(true);
<%if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>).build());
<%
}
%>
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(loadJobBuilder_<%=cid%>.build()));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)));
if (job_<%=cid%> != null && job_<%=cid%>.getStatus().getError() == null) {
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Job execution status: " + job_<%=cid%>.getStatus());
<%
}
%>
} else {
List<com.google.cloud.bigquery.BigQueryError> errorList = job_<%=cid%>.getStatus().getExecutionErrors();
throw new RuntimeException("Job failed: " + errorList.get(errorList.size() - 1));
}
/* ----END-CREATING-JOB (Cloud API)---- */
<%

View File

@@ -53,7 +53,6 @@
<PARAMETER
NAME="DBTYPE"
REPOSITORY_VALUE="DBTYPE"
FIELD="CLOSED_LIST"
NUM_ROW="10"
>

View File

@@ -1564,7 +1564,7 @@ class TeradataManager extends Manager {
private boolean useExistingConnection;
private String connection;
private static final String SEPARATOR = "/";
private static final String SEPARATOR = ",";
protected TeradataManager(String host, String port, String dbName, String tableName,
String userName, String cid, boolean useExistingConnection, String connection, String additionalParams ) {

View File

@@ -36,8 +36,6 @@ skeleton="@{org.talend.designer.components.localprovider}/components/templates/d
String defaultDateFormat = ElementParameterParser.getValue(node, "__DEFAULT_DATE_FORMAT__");
String defaultTimestampFormat = ElementParameterParser.getValue(node, "__DEFAULT_TIMESTAMP_FORMAT__");
String numGroupSep = ElementParameterParser.getValue(node, "__THOUSANDS_SEPARATOR__");
boolean useLenPrecision = "true".equals(ElementParameterParser.getValue(node, "__USE_PRECISION_LENGTH_FROM_SCHEMA__"));
if (numGroupSep == null|| numGroupSep.trim().isEmpty()) {
numGroupSep = "null";
}
@@ -209,24 +207,12 @@ org.talend.database.exasol.imp.EXABulkUtil <%=cid%> = new org.talend.database.ex
String lengthStr = "null";
String precisionStr = "null";
Integer length = column.getLength();
if(useLenPrecision) {
if (length != null) {
lengthStr = String.valueOf(length);
}
} else {
if (length != null && hasGroupSep) {
lengthStr = String.valueOf(length);
}
}
if (length != null) {
lengthStr = String.valueOf(length);
}
Integer precision = column.getPrecision();
if(useLenPrecision) {
if (precision != null) {
precisionStr = String.valueOf(precision);
}
} else {
if (precision != null && hasGroupSep) {
precisionStr = String.valueOf(precision);
}
if (precision != null) {
precisionStr = String.valueOf(precision);
}
String talendType = column.getTalendType();
if ("id_Date".equals(talendType)

View File

@@ -635,23 +635,14 @@
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="USE_PRECISION_LENGTH_FROM_SCHEMA"
FIELD="CHECK"
NUM_ROW="115"
REQUIRED="true"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-EXASolution" MODULE="exajdbc-6.0.9302.jar" MVN="mvn:org.talend.libraries/exajdbc-6.0.9302/6.3.0" REQUIRED="true" />
<IMPORT NAME="Talend-DB-Exasol-Util" MODULE="talend-db-exasol-2.1.3.jar" MVN="mvn:org.talend.libraries/talend-db-exasol/2.1.3"
UrlPath="platform:/plugin/org.talend.libraries.jdbc.exasol/lib/talend-db-exasol-2.1.3.jar" REQUIRED="true" />
<IMPORT NAME="Talend-DB-Exasol-Util" MODULE="talend-db-exasol-2.1.2.jar" MVN="mvn:org.talend.libraries/talend-db-exasol-2.1.2/6.2.0"
UrlPath="platform:/plugin/org.talend.libraries.jdbc.exasol/lib/talend-db-exasol-2.1.2.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -108,6 +108,4 @@ NB_LINE_INSERTED.NAME=Rows inserted
NB_LINE_DELETED.NAME=Rows deleted
SOURCE_QUERY.NAME=Source query
TEST_MODE.NAME=Test mode (no statements are executed)
USE_PRECISION_LENGTH_FROM_SCHEMA.NAME=Use precision and length from schema
TEST_MODE.NAME=Test mode (no statements are executed)

View File

@@ -253,9 +253,6 @@ if ("http".equals(protocol) || "https".equals(protocol)) {
client_<%=cid %>.getState().setProxyCredentials(
new org.apache.commons.httpclient.auth.AuthScope(<%=proxyHost %>, Integer.parseInt(<%=proxyPort%>), null),
new org.apache.commons.httpclient.UsernamePasswordCredentials(<%=proxyUser %>, decryptedPassword_<%=cid%>));
java.util.List<String> authPrefs_<%=cid %> = java.util.Collections.singletonList(org.apache.commons.httpclient.auth.AuthPolicy.BASIC);
client_<%=cid %>.getParams().setParameter(org.apache.commons.httpclient.auth.AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs_<%=cid %>);
<%}
}

View File

@@ -66,26 +66,25 @@
}
}
DecodeString_<%=cid%> decode_<%=cid%> = new DecodeString_<%=cid%>();
try{
fileInput<%=cid%> = new java.io.FileInputStream(<%=filename %>);
javax.mail.Session session_<%=cid %> = javax.mail.Session.getInstance(System.getProperties(), null);
javax.mail.internet.MimeMessage msg_<%=cid %> = new javax.mail.internet.MimeMessage(session_<%=cid %>, fileInput<%=cid%>);
javax.mail.internet.MimeMessage msg_<%=cid %> = new javax.mail.internet.MimeMessage(session_<%=cid %>, fileInput<%=cid%>);
java.util.List<String> list_<%=cid %> = new java.util.ArrayList<String>();
for (int i_<%=cid %> = 0; i_<%=cid %> < mailParts_<%=cid %>.length; i_<%=cid %>++) {
String part_<%=cid %> = mailParts_<%=cid %>[i_<%=cid %>];
String sep_<%=cid%>= mailSeparator_<%=cid %>[i_<%=cid %>];
if(part_<%=cid %>.equalsIgnoreCase("body")) {
for (int i_<%=cid %> =0;i_<%=cid %> < mailParts_<%=cid %>.length;i_<%=cid %>++) {
String part_<%=cid %> = mailParts_<%=cid %>[i_<%=cid %>];
String sep_<%=cid%>= mailSeparator_<%=cid %>[i_<%=cid %>];
if(part_<%=cid %>.equalsIgnoreCase("body")) {
if(msg_<%=cid %>.isMimeType("multipart/*")) {
javax.mail.Multipart mp<%=cid%> = (javax.mail.Multipart) msg_<%=cid %>.getContent();
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
if (!((disposition<%=cid%> != null) && ((disposition<%=cid%>
.equals(javax.mail.Part.ATTACHMENT)) || (disposition<%=cid%>.equals(javax.mail.Part.INLINE))))) {
// the following extract the body part(text/plain + text/html)
try{
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
if (!((disposition<%=cid%> != null) && ((disposition<%=cid%>
.equals(javax.mail.Part.ATTACHMENT)) || (disposition<%=cid%>.equals(javax.mail.Part.INLINE))))) {
// the following extract the body part(text/plain + text/html)
try{
Object content_<%=cid %> = mpart<%=cid %>.getContent();
if (content_<%=cid %> instanceof javax.mail.internet.MimeMultipart) {
javax.mail.internet.MimeMultipart mimeMultipart_<%=cid %> = (javax.mail.internet.MimeMultipart) content_<%=cid %>;
@@ -125,104 +124,105 @@
<%}%>
}
<%
//both attachment and message context in the email,bug TDI-19065
//both attachment and message context in the email,bug TDI-19065
%>
}else if(disposition<%=cid%> != null && disposition<%=cid%>.equals(javax.mail.Part.INLINE)){
list_<%=cid %>.add(mpart<%=cid%>.getContent().toString());
}
}
}
} else {
java.io.InputStream in_<%=cid %> = msg_<%=cid %>.getInputStream();
byte[] buffer_<%=cid %> = new byte[1024];
int length_<%=cid %> = 0;
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
while ((length_<%=cid %> = in_<%=cid %>.read(buffer_<%=cid %>, 0, 1024)) != -1) {
baos_<%=cid %>.write(buffer_<%=cid %>, 0, length_<%=cid %>);
}
String contentType_<%=cid%> = msg_<%=cid%>.getContentType();
String charsetName_<%=cid%> = "";
if(contentType_<%=cid%>!=null && contentType_<%=cid%>.trim().length()>0){
javax.mail.internet.ContentType cy_<%=cid%> = new javax.mail.internet.ContentType(contentType_<%=cid%>);
charsetName_<%=cid%> = cy_<%=cid%>.getParameter("charset");
}
if(charsetName_<%=cid%>!=null && charsetName_<%=cid%>.length()>0){
list_<%=cid %>.add(baos_<%=cid %>.toString(charsetName_<%=cid%>));
}else{
list_<%=cid %>.add(baos_<%=cid %>.toString());
}
in_<%=cid %>.close();
baos_<%=cid %>.close();
byte[] buffer_<%=cid %> = new byte[1024];
int length_<%=cid %> = 0;
java.io.ByteArrayOutputStream baos_<%=cid %> = new java.io.ByteArrayOutputStream();
while ((length_<%=cid %> = in_<%=cid %>.read(buffer_<%=cid %>, 0, 1024)) != -1) {
baos_<%=cid %>.write(buffer_<%=cid %>, 0, length_<%=cid %>);
}
String contentType_<%=cid%> = msg_<%=cid%>.getContentType();
String charsetName_<%=cid%> = "";
if(contentType_<%=cid%>!=null && contentType_<%=cid%>.trim().length()>0){
javax.mail.internet.ContentType cy_<%=cid%> = new javax.mail.internet.ContentType(contentType_<%=cid%>);
charsetName_<%=cid%> = cy_<%=cid%>.getParameter("charset");
}
if(charsetName_<%=cid%>!=null && charsetName_<%=cid%>.length()>0){
list_<%=cid %>.add(baos_<%=cid %>.toString(charsetName_<%=cid%>));
}else{
list_<%=cid %>.add(baos_<%=cid %>.toString());
}
in_<%=cid %>.close();
baos_<%=cid %>.close();
}
}else if(part_<%=cid %>.equalsIgnoreCase("header")){
java.util.Enumeration em = msg_<%=cid %>.getAllHeaderLines();
int em_count=0;
String tempStr_<%=cid %>="";
}else if(part_<%=cid %>.equalsIgnoreCase("header")){
java.util.Enumeration em = msg_<%=cid %>.getAllHeaderLines();
int em_count=0;
String tempStr_<%=cid %>="";
while (em.hasMoreElements()) {
tempStr_<%=cid %> = tempStr_<%=cid %> + (String) em.nextElement() + sep_<%=cid%> ;
}
list_<%=cid%>.add(decode_<%=cid%>.decode(tempStr_<%=cid%>));
} else {
if(("true").equals(mailChecked_<%=cid %>[i_<%=cid%>])){
}else{
if(("true").equals(mailChecked_<%=cid %>[i_<%=cid%>])){
String[] sa_<%=cid%> = msg_<%=cid %>.getHeader(part_<%=cid%>);
String tempStr_<%=cid%>="";
for(int i=0;i<sa_<%=cid%>.length;i++){
tempStr_<%=cid%>=tempStr_<%=cid%>+sa_<%=cid%>[i] + sep_<%=cid%>;
}
list_<%=cid%>.add(decode_<%=cid%>.decode(tempStr_<%=cid%>));
}else{
String content_<%=cid %> = msg_<%=cid %>.getHeader(part_<%=cid %>, null);
list_<%=cid %>.add(decode_<%=cid%>.decode(content_<%=cid %>));
}
}
}else{
String content_<%=cid %> = msg_<%=cid %>.getHeader(part_<%=cid %>, null);
list_<%=cid %>.add(decode_<%=cid%>.decode(content_<%=cid %>));
}
}
}
//attachment Deal
if(msg_<%=cid %>.isMimeType("multipart/*")){
javax.mail.Multipart mp<%=cid%> = (javax.mail.Multipart) msg_<%=cid %>.getContent();
String attachfileName<%=cid%> = "";
String path<%=cid%> = "";
java.io.BufferedOutputStream out<%=cid%> = null;
java.io.BufferedInputStream in<%=cid%> = null;
for (int i = 0; i < mp<%=cid%>.getCount(); i++) {
javax.mail.BodyPart mpart<%=cid%> = mp<%=cid%>.getBodyPart(i);
String disposition<%=cid%> = mpart<%=cid%>.getDisposition();
<%
// fixed bug TDI-8586,to deal with attachments download
%>
if (mpart<%=cid%>.getFileName()!=null
&& ((disposition<%=cid%> != null && (disposition<%=cid%>.equals(javax.mail.Part.ATTACHMENT) || disposition<%=cid%>.equals(javax.mail.Part.INLINE)))
|| disposition<%=cid%>==null)) { <%// TDI-29179 %>
attachfileName<%=cid%> = mpart<%=cid%>.getFileName();
attachfileName<%=cid%> = javax.mail.internet.MimeUtility.decodeText(attachfileName<%=cid%>);
if(!(<%=directory%>).endsWith("/")){
path<%=cid%> = <%=directory%> + "/";
}else{
path<%=cid%> =<%=directory%>;
}
path<%=cid%> = path<%=cid%> + attachfileName<%=cid%>;
<% if(isLog4jEnabled){ %>
log.info("<%= cid %> - Extracted attachment: '"+attachfileName<%=cid%>+"'.");
<% } %>
java.io.File attachFile = new java.io.File(path<%=cid%>);
out<%=cid%> = new java.io.BufferedOutputStream(new java.io.FileOutputStream(attachFile));
in<%=cid%> = new java.io.BufferedInputStream(mpart<%=cid%>.getInputStream());
int buffer<%=cid%> = 0;
while ((buffer<%=cid%> = in<%=cid%>.read()) != -1) {
out<%=cid%>.write(buffer<%=cid%>);
out<%=cid%>.flush();
}
out<%=cid%>.close();
in<%=cid%>.close();
}
}
}
//attachment Deal
class MessagePartProcessor {
void saveAttachment(javax.mail.Part mpart) throws IOException, javax.mail.MessagingException {
if (mpart.getFileName() != null && (
mpart.getDisposition() == null ||
(mpart.getDisposition().equals(javax.mail.Part.ATTACHMENT) || mpart.getDisposition().equals(javax.mail.Part.INLINE))
)) {
String attachFileName = javax.mail.internet.MimeUtility.decodeText(mpart.getFileName());
String path = <%=directory%>;
if(!path.endsWith("/")){
path = path + "/";
}
path = path + attachFileName;
<% if(isLog4jEnabled){ %>
log.info("<%= cid %> - Extracted attachment: '" + attachFileName + "'.");
<% } %>
java.io.File attachFile = new java.io.File(path);
java.io.BufferedOutputStream out = new java.io.BufferedOutputStream(new java.io.FileOutputStream(attachFile));
java.io.BufferedInputStream in = new java.io.BufferedInputStream(mpart.getInputStream());
int buffer = 0;
while ((buffer = in.read()) != -1) {
out.write(buffer);
out.flush();
}
out.close();
in.close();
}
}
// recursively process body parts
void processPart(javax.mail.Part part) throws javax.mail.MessagingException, IOException {
if (part.isMimeType("multipart/*")) {
javax.mail.Multipart multipartContent = (javax.mail.Multipart) part.getContent();
for (int i = 0; i < multipartContent.getCount(); i++) {
javax.mail.Part mpart = multipartContent.getBodyPart(i);
saveAttachment(mpart);
processPart(mpart);
}
}
}
}
new MessagePartProcessor().processPart(msg_<%=cid %>);
// for output
<%
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
@@ -282,10 +282,10 @@
for (int i=1;i<conns.size();i++) {
IConnection conn2 = conns.get(i);
if ((conn2.getName().compareTo(firstConnName)!=0)&&(conn2.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA))) {
for (IMetadataColumn column: metadata.getListColumns()) {%>
<%=conn2.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
<%
}
for (IMetadataColumn column: metadata.getListColumns()) {%>
<%=conn2.getName() %>.<%=column.getLabel() %> = <%=firstConnName %>.<%=column.getLabel() %>;
<%
}
}
}
}

View File

@@ -185,14 +185,14 @@ imports="
%>
for (org.jets3t.service.model.GSObject objectSummary_<%=cid%> : objects_<%=cid%>) {
String objkey_<%=cid%> = objectSummary_<%=cid%>.getKey();
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>, objkey_<%=cid%>);
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>+objkey_<%=cid%>);
org.jets3t.service.model.GSObject obj_<%=cid%> = service_<%=cid%>.getObject(currentBucketName_<%=cid%>, objkey_<%=cid%>);
<%
}else{
%>
for (java.util.Map<String, String> map_<%=cid %>: list_<%=cid%>) {
String currentBucketName_<%=cid%>=map_<%=cid %>.get("BUCKET_NAME");
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>, map_<%=cid %>.get("OBJECT_NEWNAME"));
java.io.File file_<%=cid%> = new java.io.File(<%=outputsDir%>+map_<%=cid %>.get("OBJECT_NEWNAME"));
org.jets3t.service.model.GSObject obj_<%=cid%> =null;
try {
obj_<%=cid%> = service_<%=cid%>.getObject(currentBucketName_<%=cid%>, map_<%=cid %>.get("OBJECT_KEY"));
@@ -275,4 +275,4 @@ imports="
obj_<%=cid%>.closeDataInputStream();
<%
}
%>
%>

View File

@@ -72,7 +72,7 @@
SHOW="false"
REPOSITORY_VALUE="TYPE"
>
<DEFAULT>PostgresPlus</DEFAULT>
<DEFAULT>PostgreSQL</DEFAULT>
</PARAMETER>
<PARAMETER

View File

@@ -89,7 +89,7 @@
SHOW="false"
REPOSITORY_VALUE="TYPE"
>
<DEFAULT>PostgresPlus</DEFAULT>
<DEFAULT>PostgreSQL</DEFAULT>
</PARAMETER>
<PARAMETER

View File

@@ -115,7 +115,7 @@
SHOW="false"
REPOSITORY_VALUE="TYPE"
>
<DEFAULT>PostgresPlus</DEFAULT>
<DEFAULT>PostgreSQL</DEFAULT>
</PARAMETER>
<PARAMETER

View File

@@ -69,8 +69,6 @@ skeleton="../templates/db_output_bulk.skeleton"
boolean savePoint = ("true").equals(ElementParameterParser.getValue(node,"__SAVE_POINT__"));
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean convertToLowercase = ("true").equals(ElementParameterParser.getValue(node, "__CONVERT_COLUMN_TABLE_TO_LOWERCASE__"));
String rejectConnName = null;
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
@@ -100,18 +98,6 @@ List<Column> stmtStructure = null;
if(columnList != null && columnList.size() > 0) {
stmtStructure = getManager(dbmsId, cid).createColumnList(columnList, useFieldOptions, fieldOptions, addCols);
isDynamic = isDynamic && !getManager(dbmsId, cid).isDynamicColumnReplaced();
if(convertToLowercase){
for(Column column : stmtStructure) {
if(column.isReplaced()) {
for (Column replacedColumn : column.getReplacement()) {
replacedColumn.setColumnName(replacedColumn.getColumnName().toLowerCase());
}
} else if(!column.isDynamic()){
column.setColumnName(column.getColumnName().toLowerCase());
}
}
}
}
%>
@@ -130,9 +116,9 @@ if(("true").equals(useExistingConn)) {
String tableName_<%=cid%> = null;
if(dbschema_<%=cid%> == null || dbschema_<%=cid%>.trim().length() == 0) {
tableName_<%=cid%> = (<%=table%>)<%=convertToLowercase ? ".toLowerCase()" : ""%>;
tableName_<%=cid%> = <%=table%>;
} else {
tableName_<%=cid%> = dbschema_<%=cid%> + "\".\"" + (<%=table%>)<%=convertToLowercase ? ".toLowerCase()" : ""%>;
tableName_<%=cid%> = dbschema_<%=cid%> + "\".\"" + <%=table%>;
}
<%

View File

@@ -393,14 +393,6 @@
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="CONVERT_COLUMN_TABLE_TO_LOWERCASE"
FIELD="CHECK"
NUM_ROW="25"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="USE_BATCH_SIZE"
FIELD="CHECK"

View File

@@ -49,8 +49,6 @@ skeleton="../templates/db_output_bulk.skeleton"
boolean useBatchSize = ("true").equals(ElementParameterParser.getValue(node,"__USE_BATCH_SIZE__"));
String batchSize=ElementParameterParser.getValue(node,"__BATCH_SIZE__");
boolean convertToLowercase = ("true").equals(ElementParameterParser.getValue(node, "__CONVERT_COLUMN_TABLE_TO_LOWERCASE__"));
//feature:22704
boolean savePoint = ("true").equals(ElementParameterParser.getValue(node,"__SAVE_POINT__"));
@@ -158,16 +156,11 @@ skeleton="../templates/db_output_bulk.skeleton"
if(conns_dynamic!=null && conns_dynamic.size()>0){
IConnection conn = conns_dynamic.get(0);
if(!("".equals(insertColName.toString()))) {
String insertColNameStr = null;
if(convertToLowercase)
insertColNameStr = insertColName.toString().toLowerCase();
else
insertColNameStr = insertColName.toString();
%>
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColNameStr%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToLowercase){%>.toLowerCase()<%}%>+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" (<%=insertColName.toString()%>, "+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES (<%=insertValueStmt.toString()%>, "+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
<% } else {
%>
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")<%if(convertToLowercase){%>.toLowerCase()<%}%>+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
String insert_<%=cid%> = "INSERT INTO \"" + tableName_<%=cid%> + "\" ("+DynamicUtils.getInsertIntoStmtColumnsList(<%=conn.getName()%>.<%=getDynamicColumn()%>, "<%=dbmsId %>")+") VALUES ("+DynamicUtils.getInsertIntoStmtValuesList(<%=conn.getName()%>.<%=getDynamicColumn()%>)+")";
<%
}
}

View File

@@ -98,6 +98,4 @@ NB_LINE_REJECTED.NAME=Number Of Rejected Lines
SPECIFY_DATASOURCE_ALIAS.NAME=Specify a data source alias
DATASOURCE.NAME=Data source
DATASOURCE_ALIAS.NAME=Data source alias
PROPERTIES.NAME=Additional JDBC Parameters
CONVERT_COLUMN_TABLE_TO_LOWERCASE.NAME=Convert columns and table to lowercase
PROPERTIES.NAME=Additional JDBC Parameters

View File

@@ -419,7 +419,7 @@
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar"
REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar"
MVN="mvn:commons-codec/commons-codec/1.6"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -207,7 +207,6 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -288,7 +288,6 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -378,7 +378,6 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -538,7 +538,7 @@
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.3.jar"
REQUIRED="true" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar"
MVN="mvn:commons-codec/commons-codec/1.6"
MVN="mvn:org.talend.libraries/commons-codec-1.6/6.0.0"
UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar"
REQUIRED="true" />
</IMPORTS>

View File

@@ -306,7 +306,6 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -7,7 +7,6 @@
<FAMILIES>
<FAMILY>Databases/DB Specifics/Amazon/Redshift</FAMILY>
<FAMILY>Cloud/Amazon/Redshift</FAMILY>
</FAMILIES>
<DOCUMENTATION>
@@ -282,7 +281,6 @@
<IMPORT NAME="httpcore-4.4.9.jar" MODULE="httpcore-4.4.9.jar" MVN="mvn:org.apache.httpcomponents/httpcore/4.4.9" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="httpclient-4.5.5.jar" MODULE="httpclient-4.5.5.jar" MVN="mvn:org.apache.httpcomponents/httpclient/4.5.5" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="joda-time-2.8.1.jar" MODULE="joda-time-2.8.1.jar" MVN="mvn:joda-time/joda-time/2.8.1" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="commons-codec-1.6.jar" MODULE="commons-codec-1.6.jar" MVN="mvn:commons-codec/commons-codec/1.6" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.6.jar" REQUIRED_IF="(JDBC_URL == 'SSO') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>
<RETURNS />

View File

@@ -555,92 +555,66 @@ String inputConnName = null;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// use independent process to run subjob
%>
class ConsoleHelper_<%=cid %> {
private Thread getNormalThread(Process process) {
return new Thread() {
public void run() {
try {
java.io.BufferedReader reader = new java.io.BufferedReader(
new java.io.InputStreamReader(
process.getInputStream()));
String line = "";
try {
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} finally {
reader.close();
}
} catch (java.io.IOException ioe) {
<%if(isLog4jEnabled){%>
log.error("<%=cid %> - " + ioe.getMessage());
<%}%>
ioe.printStackTrace();
}
}
};
}
private Thread getErrorThread(Process process, StringBuffer sb) {
return new Thread() {
public void run() {
try {
java.io.BufferedReader reader = new java.io.BufferedReader(
new java.io.InputStreamReader(
process.getErrorStream()));
String line = "";
try {
while ((line = reader.readLine()) != null) {
sb.append(line)
.append("\n");
}
} finally {
reader.close();
}
} catch (java.io.IOException ioe) {
<%if(isLog4jEnabled){%>
log.error("<%=cid %> - " + ioe.getMessage());
<%}%>
ioe.printStackTrace();
}
}
};
}
}
ConsoleHelper_<%=cid %> consoleHelper_<%=cid %> = new ConsoleHelper_<%=cid %>();
Runtime runtime_<%=cid %> = Runtime.getRuntime();
Process ps_<%=cid %> = null;
final Process ps_<%=cid %>;
ps_<%=cid %> = runtime_<%=cid %>.exec((String[])paraList_<%=cid %>.toArray(new String[paraList_<%=cid %>.size()]));
//0 indicates normal termination
int result_<%=cid %>;
StringBuffer errorMsg_<%=cid %> = new StringBuffer();
try {
ps_<%=cid %> = runtime_<%=cid %>.exec((String[])paraList_<%=cid %>.toArray(new String[paraList_<%=cid %>.size()]));
Thread normal_<%=cid %> = new Thread() {
public void run() {
try {
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(ps_<%=cid %>.getInputStream()));
String line = "";
try {
while((line = reader.readLine()) != null) {
System.out.println(line);
}
} finally {
reader.close();
}
} catch(java.io.IOException ioe) {
<%if(isLog4jEnabled){%>
log.error("<%=cid %> - " + ioe.getMessage());
<%}%>
ioe.printStackTrace();
}
}
};
<%if(isLog4jEnabled){%>
log.info("<%=cid%> - The child job '<%if(!useDynamicJob){%><%=childJob %><%}else{%>"+<%=dynamicJobName%>+"<%}%>' starts on the version '<%=version%>' with the context '<%=context%>'.");
<%}%>
normal_<%=cid %>.start();
<%if(isLog4jEnabled){%>
log.info("<%=cid%> - The child job '<%if(!useDynamicJob){%><%=childJob %><%}else{%>"+<%=dynamicJobName%>+"<%}%>' is done.");
<%}%>
Thread normal_<%=cid %> = consoleHelper_<%=cid %>.getNormalThread(ps_<%=cid %>);
<%if(isLog4jEnabled){%>
log.info("<%=cid%> - The child job '<%if(!useDynamicJob){%><%=childJob %><%}else{%>"+<%=dynamicJobName%>+"<%}%>' starts on the version '<%=version%>' with the context '<%=context%>'.");
<%}%>
normal_<%=cid %>.start();
<%if(isLog4jEnabled){%>
log.info("<%=cid%> - The child job '<%if(!useDynamicJob){%><%=childJob %><%}else{%>"+<%=dynamicJobName%>+"<%}%>' is done.");
<%}%>
Thread error_<%=cid %> = consoleHelper_<%=cid %>.getErrorThread(ps_<%=cid %>, errorMsg_<%=cid %>);
error_<%=cid %>.start();
result_<%=cid %> = ps_<%=cid %>.waitFor();
normal_<%=cid %>.join(10000);
error_<%=cid %>.join(10000);
} catch (ThreadDeath tde) {
<%if(isLog4jEnabled){%>
log.error("<%=cid %> - thread was terminated.");
<%}%>
ps_<%=cid %>.destroy();
throw tde;
}
final StringBuffer errorMsg_<%=cid %> = new StringBuffer();
Thread error_<%=cid %> = new Thread() {
public void run() {
try {
java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(ps_<%=cid %>.getErrorStream()));
String line = "";
try {
while((line = reader.readLine()) != null) {
errorMsg_<%=cid %>.append(line).append("\n");
}
} finally {
reader.close();
}
} catch(java.io.IOException ioe) {
<%if(isLog4jEnabled){%>
log.error("<%=cid %> - " + ioe.getMessage());
<%}%>
ioe.printStackTrace();
}
}
};
error_<%=cid %>.start();
//0 indicates normal termination
int result_<%=cid %> = ps_<%=cid %>.waitFor();
normal_<%=cid %>.join(10000);
error_<%=cid %>.join(10000);
globalMap.put("<%=cid %>_CHILD_RETURN_CODE",result_<%=cid %>);
if(result_<%=cid %> != 0){
globalMap.put("<%=cid %>_CHILD_EXCEPTION_STACKTRACE",errorMsg_<%=cid %>.toString());

View File

@@ -151,7 +151,7 @@
<IMPORT NAME="saajapi" MODULE="saaj-api-1.3.jar" MVN="mvn:org.talend.libraries/saaj-api-1.3/6.0.0" REQUIRED="true" BundleID="" />
<IMPORT NAME="saajimpl" MODULE="saaj-impl-1.3.2.jar" MVN="mvn:org.talend.libraries/saaj-impl-1.3.2/6.0.0" REQUIRED="true" BundleID="" />
<IMPORT NAME="jdom" MODULE="jdom-1.1.jar" MVN="mvn:org.talend.libraries/jdom-1.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jdom/lib/jdom-1.1.jar" REQUIRED="true" BundleID="org.apache.servicemix.bundles.jdom" />
<IMPORT NAME="talendsoap" MODULE="talend-soap-2.1-20190716.jar" MVN="mvn:org.talend.libraries/talend-soap-2.1-20190716/6.0.0" REQUIRED="true" />
<IMPORT NAME="talendsoap" MODULE="talend-soap-2.1-20190513.jar" MVN="mvn:org.talend.libraries/talend-soap-2.1-20190513/6.0.0" REQUIRED="true" />
<IMPORT NAME="Java_xercesImpl" MODULE="xercesImpl.jar" MVN="mvn:org.talend.libraries/xercesImpl/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.xml/lib/xercesImpl.jar" REQUIRED="true" BundleID="" />
<IMPORT NAME="commons-codec" MODULE="commons-codec-1.9.jar" MVN="mvn:org.talend.libraries/commons-codec-1.9/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-codec-1.9.jar" REQUIRED="true" BundleID="" />
</IMPORTS>

View File

@@ -5,7 +5,6 @@
Boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
String dbms=ElementParameterParser.getValue(node, "__MAPPING__");
boolean convertToUppercase_tableAction = "true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONVERT_COLUMN_TABLE_TO_UPPERCASE__"));
boolean convertToLowercase_tableAction = "true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONVERT_COLUMN_TABLE_TO_LOWERCASE__"));
if (!isParallelize) {
//end issue 0010346 Parallelization crash with "Drop table if exists and create"
@@ -223,7 +222,7 @@ if (!isParallelize) {
while(rsTable_<%=cid%>.next()) {
String table_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_NAME");
String schema_<%=cid%> = rsTable_<%=cid%>.getString("TABLE_SCHEM");
if(table_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(<%=table%><%if(convertToLowercase_tableAction){%>.toLowerCase()<%}%>)
if(table_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(<%=table%>)
&& (schema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(dbschema_<%=cid%>) || ((dbschema_<%=cid%> ==null || dbschema_<%=cid%>.trim().length() ==0) && defaultSchema_<%=cid%>.equals<%if(!tableNameCaseSensitive){%>IgnoreCase<%}%>(schema_<%=cid%>)))) {
whetherExist_<%=cid%> = true;
break;
@@ -378,7 +377,7 @@ if (!isParallelize) {
if(conns_dynamic!=null && conns_dynamic.size()>0){
String query=manager.getCreateTableSQL(stmtStructure);
%>
stmtCreate_<%=cid%>.execute((("<%=query%>").replace("{TALEND_DYNAMIC_COLUMN}",DynamicUtils.getCreateTableSQL(<%=conns_dynamic.get(0).getName()%>.<%=getDynamicColumn()%>, "<%=dbms==null?"":dbms.toLowerCase()%>"))+")<%=ending%>")<%if(convertToUppercase_tableAction){%>.toUpperCase()<%}else if(convertToLowercase_tableAction){%>.toLowerCase()<%}%>);
stmtCreate_<%=cid%>.execute((("<%=query%>").replace("{TALEND_DYNAMIC_COLUMN}",DynamicUtils.getCreateTableSQL(<%=conns_dynamic.get(0).getName()%>.<%=getDynamicColumn()%>, "<%=dbms==null?"":dbms.toLowerCase()%>")<%if(convertToUppercase_tableAction){%>.toUpperCase()<%}%>)+")<%=ending%>"));
<%
}
} else {

View File

@@ -8322,13 +8322,15 @@
context="plugin:org.talend.libraries.apache"
id="logback-classic-1.0.9.jar"
mvn_uri="mvn:org.talend.libraries/logback-classic-1.0.9/6.0.0"
name="logback-classic-1.0.9.jar">
name="logback-classic-1.0.9.jar"
uripath="platform:/plugin/org.talend.libraries.apache/lib/logback-classic-1.0.9.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.libraries.apache"
id="logback-core-1.0.9.jar"
mvn_uri="mvn:org.talend.libraries/logback-core-1.0.9/6.0.0"
name="logback-core-1.0.9.jar">
name="logback-core-1.0.9.jar"
uripath="platform:/plugin/org.talend.libraries.apache/lib/logback-core-1.0.9.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:"

View File

@@ -95,7 +95,7 @@
<artifactItem>
<groupId>org.talend.libraries</groupId>
<artifactId>talend-soap</artifactId>
<version>2.1-20190716</version>
<version>2.1-20190513</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${soap.dir}</outputDirectory>

View File

@@ -13,9 +13,7 @@
package org.talend.designer.core.ui.editor.cmd;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -413,8 +411,6 @@ public class ChangeActivateStatusElementCommand extends Command {
for (INode node : jobletandnodeList) {
if (node.isActivate()) {
// MiddleNodes Map<IConnection, Node> connection->Node
// if Node deactivate then connection->null
Map<IConnection, Node> outMiddleNodes = getAllOutMiddleNodes(node);
Map<IConnection, Node> inMiddleNodes = getAllInMiddleNodes(node);
@@ -461,8 +457,7 @@ public class ChangeActivateStatusElementCommand extends Command {
}
}
if (!exist) {
List<IConnection> exactConnections = getExactConnectionsBetweenNodes(node, nodeList, connList, true);
middConnMap.put(nodeList, exactConnections);
middConnMap.put(nodeList, connList);
}
}
@@ -509,86 +504,11 @@ public class ChangeActivateStatusElementCommand extends Command {
}
}
if (!exist) {
List<IConnection> exactConnections = getExactConnectionsBetweenNodes(node, nodeList, connList, false);
middConnMap.put(nodeList, exactConnections);
middConnMap.put(nodeList, connList);
}
}
}
}
// middConnMap=> key(BaseNode, Node1, Node2......);
// BaseNode->(0/some deactivate node)->Node1;BaseNode->(0/some deactivate node)->Node2;
// middConnMap=> value(connections between Node1 and Node2).
return middConnMap;
}
public static List<IConnection> getExactConnectionsBetweenNodes(INode node, List<INode> nodeList, List<IConnection> connList,
boolean isOutgoing) {
List<IConnection> exactList = new ArrayList<IConnection>(connList);
List<INode> targetNodeList = new ArrayList<INode>(nodeList);
targetNodeList.remove(node);
Map<INode, Set<INode>> pathhm = new HashMap<INode, Set<INode>>();
for (INode targetNode : targetNodeList) {
Set<INode> pathNodes = new HashSet<INode>();
pathNodes.add(node);
// Got the passby Node between node and tatgetNode
boolean pathFound = getPathsNodes(node, targetNode, pathNodes, isOutgoing);
if (pathFound) {
pathhm.put(targetNode, pathNodes);
}
}
Collection<Set<INode>> pathSets = pathhm.values();
if (!pathSets.isEmpty()) {
Iterator<IConnection> connectionIte = exactList.iterator();
while (connectionIte.hasNext()) {
IConnection connection = (IConnection) connectionIte.next();
boolean rightIn = false;
Iterator<Set<INode>> pathIte = pathSets.iterator();
while (pathIte.hasNext()) {
Set<INode> nodes = (Set<INode>) pathIte.next();
// if sourceNode and targetNode of the connection don't exist in the NodePath then this connection
// doesn't belong to this flow of BaseNode->(0/some deactivate node)->Node1
// maybe belongs to other flow of BaseNode but all flow deactivate.
if (nodes.contains(connection.getSource()) && nodes.contains(connection.getTarget())) {
rightIn = true;
}
}
if (!rightIn) {
connectionIte.remove();
}
}
}
return exactList;
}
private static boolean getPathsNodes(INode node, INode targetNode, Set<INode> nodes, boolean isOutgoing) {
List<? extends IConnection> connections = null;
if (node.equals(targetNode)) {
return true;
}
if (isOutgoing) {
connections = node.getOutgoingConnections();
} else {
connections = node.getIncomingConnections();
}
for (IConnection connection : connections) {
INode deepNode = null;
if (isOutgoing) {
deepNode = connection.getTarget();
} else {
deepNode = connection.getSource();
}
boolean flag = getPathsNodes(deepNode, targetNode, nodes, isOutgoing);
if (flag) {
nodes.add(deepNode);
return true;
}
}
return false;
}
}

View File

@@ -624,10 +624,8 @@ public class ChangeMetadataCommand extends Command {
setTableMAPPING();
if (!internal) {
if (!oldOutputMetadata.sameMetadataAs(newOutputMetadata, IMetadataColumn.OPTIONS_NONE)) {
updateColumnList(oldOutputMetadata, newOutputMetadata);
((Process) node.getProcess()).checkProcess();
}
updateColumnList(oldOutputMetadata, newOutputMetadata);
((Process) node.getProcess()).checkProcess();
}
refreshMetadataChanged();
}

View File

@@ -1383,7 +1383,7 @@ public class Node extends Element implements IGraphicalNode {
// MetadataTool.copyTable(inputTable, targetTable);
// add by wzhang for feature 7611.
String dbmsId = targetTable.getDbms();
MetadataToolHelper.copyTable(inputTable, targetTable, null, false);
MetadataToolHelper.copyTable(inputTable, targetTable, null, false, true);
MetadataToolHelper.setDBType(targetTable, dbmsId);
ChangeMetadataCommand cmc = new ChangeMetadataCommand(this, null,
tmpTableCreated ? targetTable : null, targetTable, inputSchemaParam);
@@ -1436,7 +1436,7 @@ public class Node extends Element implements IGraphicalNode {
}
boolean isJunitInput = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService = GlobalServiceRegister
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
.getDefault().getService(ITestContainerProviderService.class);
if (testContainerService != null
&& testContainerService.isTestCaseComponent(connection.getSource().getComponent())) {
@@ -1888,7 +1888,7 @@ public class Node extends Element implements IGraphicalNode {
connectionToParse = (String) value;
boolean isTestCase = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
ITestContainerProviderService testContainerService = GlobalServiceRegister
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
.getDefault().getService(ITestContainerProviderService.class);
isTestCase = getProcess() != null && testContainerService.isTestContainerProcess(getProcess());
}
@@ -3361,7 +3361,7 @@ public class Node extends Element implements IGraphicalNode {
private void checkHasMultiPrejobOrPostJobComponents() {
Map<String, INode> multiNodes = new HashMap<String, INode>();
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService jobletService = GlobalServiceRegister.getDefault()
IJobletProviderService jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (jobletService != null) {
// need to check all node from the process
@@ -3414,7 +3414,7 @@ public class Node extends Element implements IGraphicalNode {
public void checkLinks() {
boolean isJoblet = false;
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null && service.isJobletComponent(this)) {
isJoblet = true;
@@ -3820,7 +3820,7 @@ public class Node extends Element implements IGraphicalNode {
}
ICoreTisService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreTisService.class)) {
service = GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
service = (ICoreTisService) GlobalServiceRegister.getDefault().getService(ICoreTisService.class);
}
// test in case several Dynamic type has been set or if Dynamic is not the last type in schema
@@ -4449,16 +4449,16 @@ public class Node extends Element implements IGraphicalNode {
.getLastVersion(value.toString());
if (lastVersion != null) {
if (isMRServiceRegistered) {
if (GlobalServiceRegister.getDefault()
.getService(IMRProcessService.class)
if (((IMRProcessService) GlobalServiceRegister.getDefault()
.getService(IMRProcessService.class))
.isMapReduceItem(lastVersion.getProperty().getItem())) {
targetIsBigdata = true;
bigDataType = "Batch"; //$NON-NLS-1$
}
}
if (isStormServiceRegistered) {
if (GlobalServiceRegister.getDefault()
.getService(IStormProcessService.class)
if (((IStormProcessService) GlobalServiceRegister.getDefault()
.getService(IStormProcessService.class))
.isStormItem(lastVersion.getProperty().getItem())) {
targetIsBigdata = true;
bigDataType = "Streaming"; //$NON-NLS-1$
@@ -4935,7 +4935,7 @@ public class Node extends Element implements IGraphicalNode {
}
boolean isJobletNode = false;
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null && service.isJobletComponent(this)) {
isJobletNode = true;
@@ -5310,7 +5310,7 @@ public class Node extends Element implements IGraphicalNode {
public boolean isStandardJoblet() {
boolean isJoblet = false;
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null && service.isStandardJobletComponent(this)) {
isJoblet = true;
@@ -5322,7 +5322,7 @@ public class Node extends Element implements IGraphicalNode {
public boolean isJoblet() {
boolean isJoblet = false;
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null && service.isJobletComponent(this)) {
isJoblet = true;
@@ -5334,7 +5334,7 @@ public class Node extends Element implements IGraphicalNode {
public boolean isSparkJoblet() {
boolean isSparkJoblet = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
ISparkJobletProviderService sparkJobletService = GlobalServiceRegister.getDefault()
ISparkJobletProviderService sparkJobletService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault()
.getService(ISparkJobletProviderService.class);
if (sparkJobletService != null) {
isSparkJoblet = sparkJobletService.isSparkJobletComponent(this);
@@ -5346,7 +5346,7 @@ public class Node extends Element implements IGraphicalNode {
public boolean isSparkStreamingJoblet() {
boolean isSparkStreamingJoblet = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
ISparkStreamingJobletProviderService sparkJobletService = GlobalServiceRegister
ISparkStreamingJobletProviderService sparkJobletService = (ISparkStreamingJobletProviderService) GlobalServiceRegister
.getDefault().getService(ISparkStreamingJobletProviderService.class);
if (sparkJobletService != null) {
isSparkStreamingJoblet = sparkJobletService.isSparkStreamingJobletComponent(this);
@@ -5383,7 +5383,7 @@ public class Node extends Element implements IGraphicalNode {
public boolean isProgressBarNeeded() {
boolean needBar = true;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IMRProcessService.class)) {
IMRProcessService mrService = GlobalServiceRegister.getDefault()
IMRProcessService mrService = (IMRProcessService) GlobalServiceRegister.getDefault()
.getService(IMRProcessService.class);
needBar = mrService.isProgressBarNeeded(process);
}
@@ -5579,7 +5579,7 @@ public class Node extends Element implements IGraphicalNode {
public void refreshNodeContainer() {
boolean isRunning = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService runProcessService = GlobalServiceRegister.getDefault()
IRunProcessService runProcessService = (IRunProcessService) GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
if (runProcessService != null) {
isRunning = runProcessService.isJobRunning();

View File

@@ -123,7 +123,6 @@ import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
import org.talend.core.repository.utils.ProjectHelper;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.util.ItemDateParser;
@@ -1080,7 +1079,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
ElementParameterType pType;
boolean isJoblet = false;
if (param.getElement() instanceof INode && PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null && service.isJobletComponent((INode) param.getElement())) {
isJoblet = true;
@@ -1921,25 +1920,12 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
//
boolean isLimited = false;
org.talend.core.model.properties.Project currProject = getProject().getEmfProject();
org.talend.core.model.properties.Project project = ProjectManager.getInstance().getProject(this.property);
if (currProject != null && project != null && !currProject.equals(project)) {
int currOrdinal = ProjectHelper.getProjectTypeOrdinal(currProject);
int ordinal = ProjectHelper.getProjectTypeOrdinal(project);
if (currOrdinal > ordinal) {
isLimited = true;
}
}
if (!isLimited) {
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
}
} catch (PersistenceException e) {
@@ -2297,7 +2283,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
if (EParameterName.PROCESS_TYPE_VERSION.name().equals(pType.getName())) {
String jobletVersion = pType.getValue();
if (!RelationshipItemBuilder.LATEST_VERSION.equals(jobletVersion)) {
IJobletProviderService service = GlobalServiceRegister.getDefault()
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault()
.getService(IJobletProviderService.class);
if (service != null) {
Property jobletProperty = service.getJobletComponentItem(component);
@@ -2467,7 +2453,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
updateAllMappingTypes();
nc.setNeedLoadLib(false);
if (nc.isJoblet()) {
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
// reload only for stuido ,because joblet can be changed in the job editor
@@ -2481,7 +2467,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
NodeContainer nodeContainer = null;
if (isJunitContainer) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
ITestContainerGEFService testContainerService = GlobalServiceRegister.getDefault()
ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault()
.getService(ITestContainerGEFService.class);
if (testContainerService != null) {
nodeContainer = testContainerService.createJunitContainer(node);
@@ -2683,7 +2669,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
if (GlobalServiceRegister.getDefault().isServiceRegistered(IScdComponentService.class)) {
IScdComponentService service = GlobalServiceRegister.getDefault().getService(
IScdComponentService service = (IScdComponentService) GlobalServiceRegister.getDefault().getService(
IScdComponentService.class);
service.updateOutputMetadata(nc, metadataTable);
}
@@ -2810,7 +2796,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
} else {
if (PluginChecker.isJobLetPluginLoaded()) { // bug 12764
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null && service.isJobletComponent(source)) {
continue;
@@ -4586,7 +4572,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
Item item = ((IProcess2) jobletProcess).getProperty().getItem();
if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = ((JobletProcessItem) item);
IJobletProviderService service = GlobalServiceRegister.getDefault().getService(
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
IJobletProviderService.class);
if (service != null) {
service.saveJobletNode(jobletItem, jobletContainer);
@@ -4635,7 +4621,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
IJobletProviderService jobletService = null;
if (PluginChecker.isJobLetPluginLoaded()) {
jobletService = GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
jobletService = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
for (INode node : getGraphicalNodes()) {
if (jobletService.isJobletComponent(node)) {
listRoutines.addAll(getJobletRoutines(jobletService, node));

View File

@@ -14,7 +14,6 @@ package org.talend.designer.core.ui.editor.properties.controllers;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -77,7 +76,6 @@ import org.talend.designer.rowgenerator.data.Function;
import org.talend.utils.json.JSONArray;
import org.talend.utils.json.JSONException;
import org.talend.utils.json.JSONObject;
import org.talend.utils.sql.TalendTypeConvert;
import orgomg.cwm.objectmodel.core.TaggedValue;
@@ -114,12 +112,6 @@ public class ColumnListController extends AbstractElementPropertySectionControll
*/
private static final String FILTER_PREFIX_CUSTOM = "CUSTOM_COLUMNS:"; //$NON-NLS-1$
/**
* Indicate you want to filter columns by data type
* DATA_TYPE:Date,String will only keep Date and String columns
*/
private static final String FILTER_DATA_TYPE = "DATA_TYPE:"; //$NON-NLS-1$
private static Logger log = Logger.getLogger(ColumnListController.class);
private boolean updateColumnListFlag;
@@ -786,15 +778,9 @@ public class ColumnListController extends AbstractElementPropertySectionControll
}
boolean unlimited = !onlyFilterCustom && !onlyFilterNoneCustom;
boolean hasReg = false;
boolean hasDataTypeFilter = false;
List<String> datatypeNameList = null;
if (filter.startsWith(FILTER_PREFIX_REGEXP)) {
filter = filter.substring(FILTER_PREFIX_REGEXP.length());
hasReg = true;
} else if (filter.startsWith(FILTER_DATA_TYPE)) {
filter = filter.substring(FILTER_DATA_TYPE.length());
hasDataTypeFilter = true;
datatypeNameList = Arrays.asList(filter.split(FILTER_SEPARATOR));
}
boolean filterAll = false;
if (filter.equals(FILTER_ALL)) {
@@ -812,17 +798,6 @@ public class ColumnListController extends AbstractElementPropertySectionControll
columnValueList = (String[]) ArrayUtils.removeElement(columnValueList, colName);
}
}
} else if (hasDataTypeFilter && datatypeNameList != null) {
IMetadataTable metadataTable = getMetadataTable(param.getElement(), param.getContext());
for (String colName : tmpColumnNameList) {
IMetadataColumn metadataColumn = metadataTable.getColumn(colName);
String dataType = metadataColumn.getTalendType();
if (!(datatypeNameList.contains(dataType)
|| datatypeNameList.contains(TalendTypeConvert.convertToJavaType(dataType)))) {
columnNameList = (String[]) ArrayUtils.removeElement(columnNameList, colName);
columnValueList = (String[]) ArrayUtils.removeElement(columnValueList, colName);
}
}
} else {
if (filterAll) {
for (String colName : tmpColumnNameList) {
@@ -948,7 +923,28 @@ public class ColumnListController extends AbstractElementPropertySectionControll
private static List<String> getColumnList(IElement element, String context, Map<String, Boolean> customColMap) {
List<String> columnList = new ArrayList<String>();
IMetadataTable table = getMetadataTable(element, context);
IMetadataTable table = null;
if (element instanceof INode) {
table = ((INode) element).getMetadataFromConnector(context);
if (table == null) {
List<IMetadataTable> tableList = ((INode) element).getMetadataList();
if (tableList.size() == 1) {
table = tableList.get(0);
} else {
for (IMetadataTable itable : tableList) {
if (itable.getAttachedConnector() != null && !itable.getAttachedConnector().equals("REJECT")) {
table = itable;
break;
}
}
}
// if (tableList.size() > 0) {
// table = tableList.get(0);
// }
}
} else if (element instanceof IConnection) {
table = ((IConnection) element).getMetadataTable();
}
if (table != null) {
for (IMetadataColumn column : table.getListColumns()) {
@@ -972,31 +968,6 @@ public class ColumnListController extends AbstractElementPropertySectionControll
return columnList;
}
private static IMetadataTable getMetadataTable(IElement element, String context) {
IMetadataTable table = null;
if (element instanceof INode) {
table = ((INode) element).getMetadataFromConnector(context);
if (table == null) {
List<IMetadataTable> tableList = ((INode) element).getMetadataList();
if (tableList.size() == 1) {
table = tableList.get(0);
} else {
for (IMetadataTable itable : tableList) {
if (itable.getAttachedConnector() != null && !itable.getAttachedConnector().equals("REJECT")) {
table = itable;
break;
}
}
}
}
} else if (element instanceof IConnection) {
table = ((IConnection) element).getMetadataTable();
}
return table;
}
private static List<String> getPrevColumnList(INode node, Map<String, Boolean> customColMap) {
List<String> columnList = new ArrayList<String>();

View File

@@ -384,6 +384,7 @@ public class UpdateDetectionDialog extends SelectionDialog {
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
addViewerListener();
createColumns(tree);
helper.selectAll(true);
return composite;
}

View File

@@ -450,7 +450,7 @@ public final class UpdateManagerUtils {
} else {
((ProcessItem) item).setProcess(processType);
}
factory.save(item, true);
factory.save(item);
} catch (IOException e) {
ExceptionHandler.process(e);
} catch (PersistenceException e) {

View File

@@ -61,7 +61,4 @@ NameSpaceDialog.prefixInvalid=Prefix value is invalid\!
Schema2XMLDragAndDropHandler.HasChildrenWarning=has element children, can not have linker.
Schema2XMLDragAndDropHandler.IsRootWarning=is root, can not have linker.
Schema2XMLDragAndDropHandler.IsNotElementWarning=isn't a Element, can not create sub-elements or attributes.
ImportTreeFromXMLAction.ImportSchemaNotExistError=Required reference schema files are missing.
ImportTreeFromXMLAction.schemaFileNotExistDetailTitle=The following files do not exist:
Schema2XMLDragAndDropHandler.IsNotElementWarning=isn't a Element, can not create sub-elements or attributes.

View File

@@ -14,7 +14,6 @@ package org.talend.designer.fileoutputxml.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -25,11 +24,9 @@ import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.xsd.XSDSchema;
import org.talend.commons.runtime.xml.XmlUtil;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea;
import org.talend.datatools.xml.utils.ATreeNode;
import org.talend.datatools.xml.utils.SchemaPopulationUtil;
import org.talend.datatools.xml.utils.XSDPopulationUtil2;
import org.talend.designer.fileoutputxml.i18n.Messages;
import org.talend.designer.fileoutputxml.ui.FOXUI;
import org.talend.metadata.managment.ui.dialog.RootNodeSelectDialog;
import org.talend.metadata.managment.ui.wizard.metadata.xml.node.Attribute;
@@ -46,8 +43,6 @@ import org.talend.metadata.managment.ui.wizard.metadata.xml.utils.TreeUtil;
*/
public class ImportTreeFromXMLAction extends SelectionProviderAction {
private static final String LINEFEED = "\n";//$NON-NLS-1$
// the xml viewer, see FOXUI.
private TreeViewer xmlViewer;
@@ -177,32 +172,19 @@ public class ImportTreeFromXMLAction extends SelectionProviderAction {
try {
if (XmlUtil.isXSDFile(filePath)) {
XSDSchema xsdSchema = TreeUtil.getXSDSchema(filePath);
// check if there have some (<xs:import>) import reference schema xsd file don't exist
Set<String> notExistImportSchema = TreeUtil.getNotExistImportSchema(filePath, xsdSchema);
if (!notExistImportSchema.isEmpty()) {
StringBuffer detail = new StringBuffer();
detail.append(Messages.getString("ImportTreeFromXMLAction.schemaFileNotExistDetailTitle")).append(LINEFEED);//$NON-NLS-1$
for (String xsdfilePath : notExistImportSchema) {
detail.append(xsdfilePath).append(LINEFEED);
}
new ErrorDialogWidthDetailArea(xmlViewer.getControl().getShell(), Messages.PLUGIN_ID,
Messages.getString("ImportTreeFromXMLAction.ImportSchemaNotExistError"), detail.toString());//$NON-NLS-1$
}else {
List<ATreeNode> list = new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(xmlViewer.getControl().getShell(), list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, selectedNode);
changed = true;
} else {
changed = false;
}
} else {
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, list.get(0));
List<ATreeNode> list = new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(xmlViewer.getControl().getShell(), list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, selectedNode);
changed = true;
} else {
changed = false;
}
} else {
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, list.get(0));
changed = true;
}
} else {
newInput = treeNodeAdapt(filePath);

View File

@@ -26,7 +26,7 @@ public class Messages extends MessagesCore {
private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
public static final String PLUGIN_ID = "org.talend.designer.fileoutputxml"; //$NON-NLS-1$
private static final String PLUGIN_ID = "org.talend.designer.fileoutputxml"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);

View File

@@ -50,13 +50,6 @@
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.3</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>

View File

@@ -1,3 +1,3 @@
$fileDir = Split-Path -Parent $MyInvocation.MyCommand.Path
cd $fileDir
java '-Dtalend.component.manager.m2.repository=%cd%/../lib' ${talend.job.jvmargs.ps1} -cp ${talend.job.ps1.classpath} ${talend.job.class} ${talend.job.bat.addition} $args
$fileDir = Split-Path -Parent $MyInvocation.MyCommand.Path
cd $fileDir
java '-Dtalend.component.manager.m2.repository=%cd%/../lib' ${talend.job.jvmargs.ps1} -cp ${talend.job.ps1.classpath} ${talend.job.class} ${talend.job.bat.addition} %*

View File

@@ -95,7 +95,6 @@ import org.talend.commons.exception.SystemException;
import org.talend.commons.ui.runtime.exception.RuntimeExceptionHandler;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.commons.utils.resource.FileExtensions;
import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
@@ -274,7 +273,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
}
private boolean isGuessSchemaJob(Property property) {
return property != null && "ID".equals(property.getId()) && "Mock_job_for_Guess_schema".equals(property.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
return "ID".equals(property.getId()) && "Mock_job_for_Guess_schema".equals(property.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
@@ -1181,17 +1180,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
list.addAll(Arrays.asList(cmd2));
return list.toArray(new String[0]);
} else {
List<String> asList = convertArgsToList(cmd2);
if ((!isExternalUse() && isStandardJob()) || isGuessSchemaJob(property)) {
String localM2Path = "-Dtalend.component.manager.m2.repository="; //$NON-NLS-1$
if (EnvironmentUtils.isWindowsSystem()) {
localM2Path = localM2Path + "\"" + PomUtil.getLocalRepositoryPath() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
} else {
localM2Path = localM2Path + PomUtil.getLocalRepositoryPath();
}
asList.add(3, localM2Path);
}
return asList.toArray(new String[0]);
return cmd2;
}
}

View File

@@ -500,14 +500,8 @@ public class MemoryRuntimeComposite extends ScrolledComposite implements IDynami
private boolean acquireJVM() {
long startTime = System.currentTimeMillis();
long endTime;
String remoteHost = null;
int remotePort = -1;
ITargetExecutionConfig targExecConfig = processContext.getSelectedTargetExecutionConfig();
// normally this value is always null in TOS
if (targExecConfig != null) {
remoteHost = targExecConfig.getHost();
remotePort = targExecConfig.getRemotePort();
}
String remoteHost = processContext.getSelectedTargetExecutionConfig().getHost();
int remotePort = processContext.getSelectedTargetExecutionConfig().getRemotePort();
while(true){
if ((processContext != null && !processContext.isRunning()) && !isReadyToStart) {
return false;

View File

@@ -1,5 +1,5 @@
Talend Open Studio for Data Integration
Copyright (c) 2006-2019 Talend Inc. - www.talend.com
Copyright (c) 2006 - 2017 Talend Inc. - www.talend.com
All rights reserved.
@@ -21,565 +21,565 @@ The Eclipse Foundation (http://www.eclipse.org).
Licensed under the Eclipse Public License - v1.0
This product includes software developed at
This product includes software developed at
ASM Helper Minidev.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
AWS SDK Java (https://github.com/aws/aws-sdk-java).
Licensed under Apache-2.0
(C) 2016, Amazon Web Services
© 2016, Amazon Web Services
This product includes software developed at
This product includes software developed at
Amazon Aws Libraries.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Amazon SDK for Java (https://aws.amazon.com/sdkforjava).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Amazon-S3 (https://github.com/aws/aws-sdk-java/blob/master/LICENSE.txt).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
AtInject (https://code.google.com/p/atinject/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Avro MapReduce.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Box Java SDK (V2) (https://github.com/box/box-java-sdk-v2/blob/master/LICENSE).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
CSV Tools.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Castor.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Ehcache.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Ezmorph.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Google APIs Client Library for Java.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Google Gson (https://code.google.com/p/google-gson/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Groovy.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Guava (https://github.com/google/guava).
Licensed under Apache-2.0
Copyright (C) 2010 The Guava Authors
This product includes software developed at
This product includes software developed at
Guava (https://github.com/google/guava/blob/master/COPYING).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Guava: Google Core Libraries for Java (https://code.google.com/p/guava-libraries/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Guava: Google Core Libraries for Java 1.6+ (https://code.google.com/p/guava-libraries/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Guava: Google Core Libraries for Java 1.6+.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Hadoop Libraries.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Hadoop Libraries (Retrieved from CDH3u0. LICENSE.txt explains that Zookeeper is distributed under Apache License 2.0).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Ini4j.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
JClouds.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jackcess (http://jackcess.sourceforge.net/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jackson.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jackson JSON Processor (http://wiki.fasterxml.com/JacksonLicensing).
Licensed under Apache-2.0
Copyright (C) 2012-2013 FasterXML.
Copyright © 2012-2013 FasterXML.
This product includes software developed at
This product includes software developed at
Jackson JSON processor.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jackson Java JSON-processor.
Licensed under Apache-2.0
Copyright ©2009 FasterXML, LLC
This product includes software developed at
This product includes software developed at
Jackson Java JSON-processor.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jackson Libraries.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jasypt : Java Simplified Encryption.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
JetS3t.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jettison.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Joda Time.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Joda-Time (http://www.joda.org/joda-time/).
Licensed under Apache-2.0
Copyright ©2002-2016 Joda.org
This product includes software developed at
This product includes software developed at
Joda-Time (http://www.joda.org/joda-time/).
Licensed under Apache-2.0
Copyright ©2002-2015 Joda.org
This product includes software developed at
This product includes software developed at
Joda-Time.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Json Simple (https://code.google.com/p/json-simple/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Json-Simple (https://github.com/fangyidong/json-simple).
Licensed under Apache-2.0
Yidong Fang
Chris Nokleberg
Dave Hughes
This product includes software developed at
This product includes software developed at
Lucene Core.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
MarkLogic Java Client API.
Licensed under Apache-2.0
Copyright 2012-2015 MarkLogic Corporation
This product includes software developed at
This product includes software developed at
Microsoft Azure SDK for Java (https://github.com/Azure/azure-sdk-for-java).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
OpenSAML (https://wiki.shibboleth.net/confluence/display/OpenSAML/Home/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Plexus (https://codehaus-plexus.github.io/index.html).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Resty : A simple HTTP REST client for Java.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Rocoto (http://99soft.github.io/rocoto/index.html
).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Sisu Guice (https://github.com/sonatype/sisu-guice).
Licensed under Apache-2.0
Copyright (c) 2006 Google, Inc. All rights reserved.
This product includes software developed at
This product includes software developed at
Sonatype Plexus (https://github.com/sonatype?utf8=%E2%9C%93&query=plexus).
Licensed under Apache-2.0
Copyright The Codehaus Foundation.
This product includes software developed at
This product includes software developed at
Spring.
Licensed under Apache-2.0
Pivotal Software Inc. / The original author or authors
This product includes software developed at
This product includes software developed at
SshJ (https://github.com/shikhar/sshj/blob/master/LICENSE).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
StAX API.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
StAXON - JSON via StAX (https://github.com/beckchr/staxon/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Talend ESB Libraries.
Licensed under Apache-2.0
Talend
This product includes software developed at
This product includes software developed at
WSS4J.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Woden.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Woodstox.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
XMLSchema.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Xerces2 Java Parser.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
XmlBeans.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
XmlSchema Core.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Zip4J.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
google-gson.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
google-guice (https://code.google.com/p/google-guice/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
json-path (https://code.google.com/p/json-path/).
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
json-smart.
Licensed under Apache-2.0
This product includes software developed at
This product includes software developed at
Jetty (http://www.eclipse.org/jetty/).
Licensed under Apache-2.0;EPL-1.0
Copyright (C) 2016 The Eclipse Foundation.
Copyright © 2016 The Eclipse Foundation.
This product includes software developed at
This product includes software developed at
Jetty.
Licensed under Apache-2.0;EPL-1.0
This product includes software developed at
This product includes software developed at
Jetty (http://www.eclipse.org/jetty/licenses.php).
Licensed under Apache-2.0;EPL-1.0
This product includes software developed at
This product includes software developed at
Jackson Java JSON-processor.
Licensed under Apache-2.0;LGPL-2.1
This product includes software developed at
This product includes software developed at
Woodstox : High-performance XML processor (http://woodstox.codehaus.org/ http://woodstox.codehaus.org/Download).
Licensed under Apache-2.0;LGPL-2.1
This product includes software developed at
This product includes software developed at
Woodstox : High-performance XML processor (http://woodstox.codehaus.org).
Licensed under Apache-2.0;LGPL-2.1
This product includes software developed at
This product includes software developed at
Cryptacular.
Licensed under Apache-2.0;LGPL-3.0
This product includes software developed at
This product includes software developed at
SqliteJDBC.
Licensed under BSD-2-Clause
This product includes software developed at
This product includes software developed at
ASM.
Licensed under BSD-3-Clause
INRIA
This product includes software developed at
This product includes software developed at
AntlR.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Antlr 3 Runtime.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Force.com Web Service Connector (WSC).
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Ganymed SSH-2 for Java.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
HsqlDB.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Jaxen.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Paraccel JDBC Driver.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
PostgreSQL JDBC Driver.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Salesforce.com (http://www.force.com).
Licensed under BSD-3-Clause
Copyright (c) 2005-2013, salesforce.com
This product includes software developed at
This product includes software developed at
Scala (http://www.scala-lang.org/).
Licensed under BSD-3-Clause
Copyright (c) 2002-2016 EPFL; Copyright (c) 2011-2016 Lightbend, Inc. (formerly Typesafe, Inc.)
This product includes software developed at
This product includes software developed at
XStream (http://xstream.codehaus.org/license.html).
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
XStream.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
XStream Core.
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
jsr-305 (JSR 305: Annotations for Software Defect Detection in Java;https://code.google.com/p/jsr-305/).
Licensed under BSD-3-Clause
This product includes software developed at
This product includes software developed at
Java API for RESTful Services.
Licensed under CDDL-1.1
This product includes software developed at
This product includes software developed at
Java API for RESTful Services (http://grepcode.com/snapshot/repo1.maven.org/maven2/javax.ws.rs/javax.ws.rs-api/2.0-m10).
Licensed under CDDL-1.1
This product includes software developed at
This product includes software developed at
Jaxb.
Licensed under CDDL-1.1;GPL-2.0-with-classpath-exception
This product includes software developed at
This product includes software developed at
WSDL4J.
Licensed under CPL-1.0
This product includes software developed at
This product includes software developed at
Aether (http://www.eclipse.org/aether/).
Licensed under EPL-1.0
Copyright (c) 2010, 2014 Sonatype, Inc.
This product includes software developed at
This product includes software developed at
Eclipse Sisu.
Licensed under EPL-1.0
Copyright (c) 2010, 2015 Sonatype, Inc.
This product includes software developed at
This product includes software developed at
H2 Embedded Database and JDBC Driver (H2 is EPL 1.0 !).
Licensed under EPL-1.0
This product includes software developed at
This product includes software developed at
Jetty.
Licensed under EPL-1.0
Copyright (c) ${copyright-range} Mort Bay Consulting Pty. Ltd.
This product includes software developed at
This product includes software developed at
Mondrian.
Licensed under EPL-1.0
This product includes software developed at
This product includes software developed at
SWTChart.
Licensed under EPL-1.0
This product includes software developed at
This product includes software developed at
Logback.
Licensed under EPL-1.0;LGPL-2.1
This product includes software developed at
This product includes software developed at
Java Json (http://www.json.org/license.html).
Licensed under Json
This product includes software developed at
This product includes software developed at
org-json-java.
Licensed under Json
This product includes software developed at
This product includes software developed at
AOP Alliance (Java/J2EE AOP standards) (http://aopalliance.sourceforge.net/).
Licensed under Public Domain
This product includes software developed at
This product includes software developed at
Simple API for CSS.
Licensed under W3C
This product includes software developed at
This product includes software developed at
BCProv.
Licensed under X11
Copyright (c) 2000 - 2016 The Legion of the Bouncy Castle Inc. (https://www.bouncycastle.org)
This product includes software developed at
This product includes software developed at
BouncyCastle.
Licensed under X11
This product includes software developed at
This product includes software developed at
SL4J.
Licensed under X11
This product includes software developed at
This product includes software developed at
SL4J (http://www.slf4j.org/license.html).
Licensed under X11
This product includes software developed at
This product includes software developed at
SL4J.
Licensed under X11
Copyright (c) 2004-2013 QOS.ch
This product includes software developed at
This product includes software developed at
Simple Logging Facade for Java (http://www.slf4j.org/license.html).
Licensed under X11
This product includes software developed at
This product includes software developed at
Simple Logging Facade for Java.
Licensed under X11
This product includes software developed at
This product includes software developed at
dropbox-sdk-java : Java library for the Dropbox Core API.
Licensed under X11

View File

@@ -1,4 +1,4 @@
Copyright (c) 2006-2019 Talend Inc. - www.talend.com
Copyright (c) 2006 - 2019 Talend Inc. - www.talend.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View File

@@ -3215,14 +3215,6 @@
name="RenameTCOMPCouchbaseMigrationTask"
version="7.2.1">
</projecttask>
<projecttask
beforeLogon="false"
class="org.talend.repository.model.migration.AddEncodingTypeForDQComponentsTask"
description="Add the encoding type for some dq components"
id="org.talend.repository.model.migration.AddEncodingTypeForDQComponentsTask"
name="AddEncodingTypeForDQComponentsTask"
version="7.3.1">
</projecttask>
</extension>
<extension

View File

@@ -974,7 +974,9 @@ public class RepositoryService implements IRepositoryService, IRepositoryContext
@Override
public void run() {
retry.set(askRetryForNetworkIssueInDialog(null, ex));
Shell shell = DisplayUtils.getDefaultShell(false);
retry.set(askRetryForNetworkIssueInDialog(shell, ex));
shell.dispose();
}
});
}

View File

@@ -1,112 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.model.migration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.filters.IComponentFilter;
import org.talend.core.model.migration.AbstractJobMigrationTask;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.properties.Item;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
/**
* Migration for added the combo list of encoding type
*/
public class AddEncodingTypeForDQComponentsTask extends AbstractJobMigrationTask {
/*
* (non-Javadoc)
*
* @see org.talend.migration.IMigrationTask#getOrder()
*/
@Override
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2019, 7, 9, 0, 0, 0);
return gc.getTime();
}
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
try {
IComponentFilter filter = new IComponentFilter() {
final transient List<String> names = new ArrayList<String>() {
private static final long serialVersionUID = 1L;
{
add("tDataMasking"); //$NON-NLS-1$
add("tPatternMasking"); //$NON-NLS-1$
add("tPatternUnmasking"); //$NON-NLS-1$
add("tRuleSurvivorship"); //$NON-NLS-1$
}
};
@Override
public boolean accept(NodeType node) {
return names.contains(node.getComponentName());
}
};
IComponentConversion checkGIDType = new CheckGIDType();
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion> asList(checkGIDType));
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
private class CheckGIDType implements IComponentConversion {
@Override
public void transform(NodeType node) {
if (ComponentUtilities.getNodeProperty(node, "ENCODING") == null) { //$NON-NLS-1$
ElementParameterType encodingContent = TalendFileFactory.eINSTANCE.createElementParameterType();
encodingContent.setName("ENCODING"); //$NON-NLS-1$
encodingContent.setField(EParameterFieldType.ENCODING_TYPE.getName());
encodingContent.setValue("\"\""); //$NON-NLS-1$
node.getElementParameter().add(encodingContent);
}
if (ComponentUtilities.getNodeProperty(node, "ENCODING:ENCODING_TYPE") == null) { //$NON-NLS-1$
ElementParameterType encodingType = TalendFileFactory.eINSTANCE.createElementParameterType();
encodingType.setName("ENCODING:ENCODING_TYPE"); //$NON-NLS-1$
encodingType.setField(EParameterFieldType.TECHNICAL.getName());
encodingType.setValue("CUSTOM"); //$NON-NLS-1$
node.getElementParameter().add(encodingType);
}
}
}
}

View File

@@ -374,7 +374,7 @@ public class ImportProjectHelper {
while (childrenEnum.hasNext()) {
Object child = childrenEnum.next();
if (level < 1) {
if (provider.isFolder(child) && !".svnlog".equals(provider.getLabel(child))) { // $NON-NLS-1$
if (provider.isFolder(child)) {
collectProjectFilesFromProvider(files, provider, child, level + 1, monitor, searchFileName);
}
}

View File

@@ -56,11 +56,6 @@ public class QueryTypeProcessor extends SingleTypeProcessor {
if (isCDCConnection(node)) {
return false;
}
if (node.getObject() == null && node.getParent() != null) {
if (ERepositoryObjectType.METADATA.equals(node.getParent().getContentType())) {
return false;
}
}
return true;
}

View File

@@ -769,7 +769,6 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
Manifest manifest = null;
try {
manifest = analyzer.calcManifest();
filterImportPackages(manifest);
} catch (IOException e) {
throw e;
} catch (Exception e) {
@@ -793,38 +792,6 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
return manifest;
}
private void filterImportPackages(Manifest manifest) {
// remove import packages which are present in private packages
List<String> privatePackages = new ArrayList<String>();
String privatePackagesString = manifest.getMainAttributes().getValue(Analyzer.PRIVATE_PACKAGE);
if (privatePackagesString != null) {
String [] packages = privatePackagesString.split(",");
for (String p : packages) {
privatePackages.add(p);
}
}
StringBuilder fileterdImportPackage = new StringBuilder();
String importPackagesString = manifest.getMainAttributes().getValue(Analyzer.IMPORT_PACKAGE);
if (importPackagesString != null) {
String [] packages = importPackagesString.split(",");
for (String p : packages) {
String importPackage = p.split(";")[0];
if (!privatePackages.contains(importPackage) || importPackage.startsWith("routines")) {
fileterdImportPackage.append(p).append(",");
}
}
}
String str = fileterdImportPackage.toString();
if (str != null && str.length() > 0 && str.endsWith(",")) {
str = str.substring(0, str.length() - 1);
}
manifest.getMainAttributes().putValue(Analyzer.IMPORT_PACKAGE, str);
}
protected Analyzer createAnalyzer(ExportFileResource libResource, ProcessItem processItem) throws IOException {
Analyzer analyzer = new Analyzer();

12
pom.xml
View File

@@ -156,7 +156,6 @@
<module>test/plugins/org.talend.designer.webservice.test</module>
<module>test/plugins/org.talend.designer.scd.test</module>
<module>test/plugins/org.talend.designer.unifiedcomponent.test</module>
<module>test/plugins/org.talend.sdk.component.studio-integration.test</module>
</modules>
<build>
<plugins>
@@ -166,17 +165,6 @@
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,143 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package core.ui.editor.cmd;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.INode;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.designer.core.ui.editor.cmd.ChangeActivateStatusElementCommand;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
/**
* DOC jding class global comment. Detailled comment
*/
public class ChangeActivateStatusElementCommandTest {
@Test
public void testGetExactConnectionsBetweenNodes() {
String nodestr = "tMysqlInput";
String nodestr1 = "tLogRow";
IComponent tMysqlComponent = ComponentsFactoryProvider.getInstance().get(nodestr,
ComponentCategory.CATEGORY_4_DI.getName());
IComponent tLogRowComponent = ComponentsFactoryProvider.getInstance().get(nodestr1,
ComponentCategory.CATEGORY_4_DI.getName());
Property property = PropertiesFactory.eINSTANCE.createProperty();
Process process = new Process(property);
// Flow1 BaseNode->Node1->Node2
Node baseNode = new Node(tMysqlComponent, process);
Node node1 = new Node(tLogRowComponent, process);
Node node2 = new Node(tLogRowComponent, process);
IConnection conn1 = createConnection(baseNode, node1);
((List<IConnection>) baseNode.getOutgoingConnections()).add(conn1);
((List<IConnection>) node1.getIncomingConnections()).add(conn1);
IConnection conn2 = createConnection(node1, node2);
((List<IConnection>) node1.getOutgoingConnections()).add(conn2);
((List<IConnection>) node2.getIncomingConnections()).add(conn2);
// Flow2 BaseNode->Node3->Node4
Node node3 = new Node(tLogRowComponent, process);
Node node4 = new Node(tLogRowComponent, process);
IConnection conn3 = createConnection(baseNode, node3);
((List<IConnection>) baseNode.getOutgoingConnections()).add(conn3);
((List<IConnection>) node3.getIncomingConnections()).add(conn3);
IConnection conn4 = createConnection(node3, node4);
((List<IConnection>) node3.getOutgoingConnections()).add(conn4);
((List<IConnection>) node4.getIncomingConnections()).add(conn4);
// Flow3 BaseNode->Node5->Node6
Node node5 = new Node(tLogRowComponent, process);
Node node6 = new Node(tLogRowComponent, process);
IConnection conn5 = createConnection(baseNode, node5);
((List<IConnection>) baseNode.getOutgoingConnections()).add(conn5);
((List<IConnection>) node5.getIncomingConnections()).add(conn5);
IConnection conn6 = createConnection(node5, node6);
((List<IConnection>) node5.getOutgoingConnections()).add(conn6);
((List<IConnection>) node6.getIncomingConnections()).add(conn6);
// case1 All activate
List<INode> nodeList = new ArrayList<INode>();
nodeList.add(baseNode);
nodeList.add(node1);
nodeList.add(node3);
nodeList.add(node5);
List<IConnection> connList = new ArrayList<IConnection>();
// connList conn1,conn3,conn5
connList.add(conn1);
connList.add(conn3);
connList.add(conn5);
List<IConnection> exactConnection = ChangeActivateStatusElementCommand.getExactConnectionsBetweenNodes(baseNode, nodeList,
connList, true);
Assert.assertTrue(exactConnection.size() == 3);
Assert.assertTrue(exactConnection.contains(conn1));
Assert.assertTrue(exactConnection.contains(conn3));
Assert.assertTrue(exactConnection.contains(conn5));
// case2 Flow1 Flow3 deactivate
nodeList = new ArrayList<INode>();
nodeList.add(baseNode);
nodeList.add(node3);
// connList conn1,conn2,conn3,conn5,conn6
connList.add(conn2);
connList.add(conn6);
List<IConnection> exactConnection1 = ChangeActivateStatusElementCommand.getExactConnectionsBetweenNodes(baseNode,
nodeList,
connList, true);
Assert.assertTrue(exactConnection1.size() == 1);
Assert.assertTrue(exactConnection1.contains(conn3));
// case3 Flow1 deactivate, Node3 & Node5 deactivate
nodeList = new ArrayList<INode>();
nodeList.add(baseNode);
nodeList.add(node4);
nodeList.add(node6);
// connList conn1,conn2,conn3,conn4,conn5,conn6
connList.add(conn4);
List<IConnection> exactConnection2 = ChangeActivateStatusElementCommand.getExactConnectionsBetweenNodes(baseNode,
nodeList, connList, true);
Assert.assertTrue(exactConnection2.size() == 4);
Assert.assertTrue(exactConnection2.contains(conn3));
Assert.assertTrue(exactConnection2.contains(conn4));
Assert.assertTrue(exactConnection2.contains(conn5));
Assert.assertTrue(exactConnection2.contains(conn6));
// case4 Flow2 inComing, Node3 deactivate
nodeList = new ArrayList<INode>();
nodeList.add(node4);
nodeList.add(baseNode);
List<IConnection> exactConnection3 = ChangeActivateStatusElementCommand.getExactConnectionsBetweenNodes(node4, nodeList,
connList, false);
Assert.assertTrue(exactConnection3.size() == 2);
Assert.assertTrue(exactConnection2.contains(conn3));
Assert.assertTrue(exactConnection2.contains(conn4));
}
private Connection createConnection(Node sourceNode, Node targetNode) {
Connection connection = new Connection(sourceNode, targetNode, EConnectionType.FLOW_MAIN, false);
return connection;
}
}

View File

@@ -0,0 +1,30 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package java;
import org.junit.Test;
/**
* DOC bqian class global comment. Detailled comment <br/>
*
*/
public class JavaProcessorTest {
/**
* Test method for {@link org.talend.designer.runprocess.Processor#replaceSnippet(java.lang.String)}.
*/
@Test
public void testReplaceSnippet() {
}
}

View File

@@ -1,136 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.runprocess.java;
import java.util.Arrays;
import java.util.Date;
import org.junit.Assert;
import org.junit.Test;
import org.talend.commons.utils.VersionUtils;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.ProcessorException;
import org.talend.designer.runprocess.ProcessorUtilities;
/**
*
* created by hcyi on Jul 22, 2019 Detailled comment
*
*/
public class JavaProcessorTest {
/**
* Test method for {@link org.talend.designer.runprocess.Processor#replaceSnippet(java.lang.String)}.
*
* @throws ProcessorException
*/
@Test
public void testReplaceSnippet() throws ProcessorException {
}
@Test
public void testGetCommandLine4ExportConfig() throws ProcessorException {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setId("_rHnrstwXEeijXfdWFqSaEA"); //$NON-NLS-1$
property.setLabel("test"); //$NON-NLS-1$
property.setVersion(VersionUtils.DEFAULT_VERSION);
Process process = new Process(property);
JavaProcessor processor = new JavaProcessor(process, property, false);
// only for export
ProcessorUtilities.setExportConfig(JavaUtils.JAVA_APP_NAME, null, null);
String[] cmd = processor.getCommandLine();
Assert.assertTrue(cmd.length > 2);
Assert.assertEquals(processor.extractAheadCommandSegments().toString(), Arrays.asList(cmd).subList(0, 2).toString());
}
@Test
public void testGetCommandLine4ExecutionIsNotStandardJob() throws ProcessorException {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setId("_rHnrstwXEeijXfdWFqSaEA"); //$NON-NLS-1$
property.setLabel("test"); //$NON-NLS-1$
property.setVersion(VersionUtils.DEFAULT_VERSION);
Process process = new Process(property);
JavaProcessor processor = new JavaProcessor(process, property, false);
//
ProcessorUtilities.setExportConfig(JavaUtils.JAVA_APP_NAME, null, null, false, new Date());
String[] cmd = processor.getCommandLine();
Assert.assertFalse(Arrays.asList(cmd).contains(getLocalM2Path()));
}
@Test
public void testGetCommandLine4ExecutionIsStandardJob() throws ProcessorException {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setId("_rHnrstwXEeijXfdWFqSaEA"); //$NON-NLS-1$
property.setLabel("test"); //$NON-NLS-1$
property.setVersion(VersionUtils.DEFAULT_VERSION);
ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
processItem.setProperty(property);
processItem.setProcess(TalendFileFactory.eINSTANCE.createProcessType());
processItem.setState(PropertiesFactory.eINSTANCE.createItemState());
Process process = new Process(property);
JavaProcessor processor = new JavaProcessor(process, property, false);
//
ProcessorUtilities.setExportConfig(JavaUtils.JAVA_APP_NAME, null, null, false, new Date());
String[] cmd = processor.getCommandLine();
Assert.assertTrue(Arrays.asList(cmd).contains(getLocalM2Path()));
Assert.assertEquals(getLocalM2Path(), Arrays.asList(cmd).get(3));
}
@Test
public void testGetCommandLine4ExecutionIsGuessSchemaJob() throws ProcessorException {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setId("ID"); //$NON-NLS-1$
property.setLabel("Mock_job_for_Guess_schema"); //$NON-NLS-1$
property.setVersion(VersionUtils.DEFAULT_VERSION);
Process process = new Process(property);
JavaProcessor processor = new JavaProcessor(process, property, false);
//
ProcessorUtilities.setExportConfig(JavaUtils.JAVA_APP_NAME, null, null, false, new Date());
String[] cmd = processor.getCommandLine();
Assert.assertTrue(Arrays.asList(cmd).contains(getLocalM2Path()));
Assert.assertEquals(getLocalM2Path(), Arrays.asList(cmd).get(3));
}
private String getLocalM2Path() {
String localM2Path = "-Dtalend.component.manager.m2.repository="; //$NON-NLS-1$
if (EnvironmentUtils.isWindowsSystem()) {
localM2Path = localM2Path + "\"" + PomUtil.getLocalRepositoryPath() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
} else {
localM2Path = localM2Path + PomUtil.getLocalRepositoryPath();
}
return localM2Path;
}
}

View File

@@ -1,112 +0,0 @@
package org.talend.repository.ui.processor;
import org.junit.Assert;
import org.junit.Test;
import org.talend.commons.ui.runtime.image.ECoreImage;
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.properties.DatabaseConnectionItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.FakePropertyImpl;
import org.talend.core.model.repository.RepositoryViewObject;
import org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.IRepositoryNode.EProperties;
import org.talend.repository.model.RepositoryNode;
import org.talend.repository.model.StableRepositoryNode;
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
/**
* created by hcyi on Jul 12, 2019
* Detailled comment
*
*/
public class QueryTypeProcessorTest {
@Test
public void testSelectRepositoryNode4SimpleFolder() {
QueryTypeProcessor query = new QueryTypeProcessor(null);
//
RepositoryNode parent = new RepositoryNode(null, null, ENodeType.STABLE_SYSTEM_FOLDER);
parent.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA);
parent.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA);
parent.setType(ENodeType.STABLE_SYSTEM_FOLDER);
// simple folder
Property property1 = new FakePropertyImpl();
Item item1 = PropertiesFactory.eINSTANCE.createFolderItem();
property1.setItem(item1);
RepositoryViewObject object1 = new RepositoryViewObject(property1, true);
RepositoryNode node1 = new RepositoryNode(object1, parent, ENodeType.SIMPLE_FOLDER);
Assert.assertEquals(node1.getObjectType().getType(), ERepositoryObjectType.FOLDER.getType());
Assert.assertTrue(query.selectRepositoryNode(null, parent, node1));
}
@Test
public void testSelectRepositoryNode4MetadataConnections() {
QueryTypeProcessor query = new QueryTypeProcessor(null);
//
RepositoryNode parent = new RepositoryNode(null, null, ENodeType.STABLE_SYSTEM_FOLDER);
parent.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA);
parent.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA);
parent.setType(ENodeType.STABLE_SYSTEM_FOLDER);
// metadata connections
Property property2 = new FakePropertyImpl();
Item item2 = PropertiesFactory.eINSTANCE.createFolderItem();
property2.setItem(item2);
RepositoryNode node2 = new RepositoryNode(null, parent, ENodeType.STABLE_SYSTEM_FOLDER);
node2.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CONNECTIONS);
node2.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CONNECTIONS);
Assert.assertFalse(query.selectRepositoryNode(null, parent, node2));
}
@Test
public void testSelectRepositoryNode4CDC() {
QueryTypeProcessor query = new QueryTypeProcessor(null);
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
// db connection
Property property = new FakePropertyImpl();
DatabaseConnectionItem item = PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
property.setItem(item);
RepositoryViewObject object = new RepositoryViewObject(property, true);
RepositoryNode cdcNode = new RepositoryNode(object, null, ENodeType.STABLE_SYSTEM_FOLDER);
cdcNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CONNECTIONS);
cdcNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CONNECTIONS);
//
StableRepositoryNode connTypeNode = new StableRepositoryNode(cdcNode, "cdc1", ECoreImage.METADATA_CDC_CONN_ICON);
cdcNode.getChildren().add(connTypeNode);
MetadataTable inputTable = ConnectionFactory.eINSTANCE.createMetadataTable();
inputTable.setId(factory.getNextId());
inputTable.setLabel("Input1");//$NON-NLS-1$
MetadataTableRepositoryObject modelObj = new MetadataTableRepositoryObject(cdcNode.getObject(), inputTable);
modelObj.setLabel("testObject1");
RepositoryNode tableNode = new RepositoryNode(modelObj, connTypeNode, ENodeType.REPOSITORY_ELEMENT);
tableNode.setProperties(EProperties.LABEL, "testObject1");
tableNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_CDC);
connTypeNode.getChildren().add(tableNode);
Assert.assertFalse(query.selectRepositoryNode(null, null, tableNode));
Assert.assertTrue(query.selectRepositoryNode(null, null, connTypeNode));
}
}

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.sdk.component.studio-integration.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@@ -1,23 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SDK studio-integration test
Bundle-SymbolicName: org.talend.sdk.component.studio-integration.test
Bundle-Version: 7.3.1.qualifier
Fragment-Host: org.talend.sdk.component.studio-integration
Automatic-Module-Name: org.talend.sdk.component.studio-integration.test
Bundle-Vendor: .Talend SA.
Export-Package: org.talend.sdk.component.studio;
uses:="org.talend.sdk.component.studio.debounce,
org.talend.sdk.component.studio.metadata,
org.talend.sdk.component.studio.service,
org.talend.sdk.component.studio.websocket",
org.talend.sdk.component.studio.debounce,
org.talend.sdk.component.studio.lang,
org.talend.sdk.component.studio.model.connector,
org.talend.sdk.component.studio.model.parameter;uses:="org.talend.sdk.component.studio,org.talend.sdk.component.studio.model.parameter.command",
org.talend.sdk.component.studio.model.parameter.listener;uses:="org.talend.sdk.component.studio.model.action,org.talend.sdk.component.studio.model.parameter",
org.talend.sdk.component.studio.service
Require-Bundle: org.junit,
org.junit.jupiter.api,
org.talend.testutils,
org.eclipse.jdt.core

View File

@@ -1 +0,0 @@
jarprocessor.exclude.children=true

View File

@@ -1,4 +0,0 @@
source.. = src/main/java/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tdi-studio-se</artifactId>
<version>7.3.1-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.sdk.component.studio-integration.test</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View File

@@ -1,64 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.debounce;
import static java.lang.Thread.sleep;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
public class DebounceManagerTest {
@Test
public void debounce() throws InterruptedException {
try (final DebounceManager manager = new DebounceManager()) {
final DebouncedAction action = manager.createAction();
final Collection<Long> timestamps = new ArrayList<>();
action.debounce(() -> timestamps.add(System.nanoTime()), 1000);
sleep(1500);
assertEquals(1, timestamps.size());
// execute only once
sleep(1500);
assertEquals(1, timestamps.size());
// can be reused
timestamps.clear();
action.debounce(() -> timestamps.add(System.nanoTime()), 1000);
sleep(1500);
assertEquals(1, timestamps.size());
// can be updated
timestamps.clear();
final long start = System.nanoTime();
action.debounce(() -> timestamps.add(0L), 1000);
sleep(500);
action.debounce(() -> timestamps.add(System.nanoTime()), 1000);
sleep(1300);
assertEquals(1, timestamps.size());
final long waitDuration = timestamps.iterator().next() - start;
// 1s after the last update which happens after 500ms
assertEquals(TimeUnit.NANOSECONDS.toMillis(waitDuration), 1500, 100);
// ensure we can start an action and close the manager without errors
action.debounce(() -> timestamps.add(System.nanoTime()), 10000);
}
}
}

View File

@@ -1,37 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.sdk.component.studio.lang;
import org.junit.jupiter.api.Assertions;
import org.junit.Test;
public class StringsTest {
@Test
public void testRequireNonEmpty() {
final String expected = "some string";
final String actual = Strings.requireNonEmpty(expected);
Assertions.assertEquals(expected, actual);
IllegalArgumentException e = Assertions.assertThrows(IllegalArgumentException.class, () -> Strings.requireNonEmpty(""));
Assertions.assertEquals("String arg should not be empty", e.getMessage());
}
@Test
public void testRemoveQuotes() {
Assertions.assertEquals("some string", Strings.removeQuotes("\"some string\""));
Assertions.assertEquals("some\"inner\" string", Strings.removeQuotes("\"some\"inner\" string\""));
Assertions.assertEquals("\"some string", Strings.removeQuotes("\"some string"));
Assertions.assertEquals("some string\"", Strings.removeQuotes("some string\""));
}
}

View File

@@ -1,72 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.model.connector;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Assertions;
import org.junit.Test;
import org.talend.core.model.process.EConnectionType;
/**
* Unit-tests for {@link AbstractConnectorCreator}
*/
public class AbstractConnectorCreatorTest {
private static final String DEFAULT = "__default__";
@Test
public void testGetTypeDefault() {
EConnectionType expectedType = EConnectionType.FLOW_MAIN;
EConnectionType actualType = AbstractConnectorCreator.getType(DEFAULT);
assertEquals(expectedType, actualType);
}
@Test
public void testGetTypeMain() {
EConnectionType expectedType = EConnectionType.FLOW_MAIN;
EConnectionType actualType = AbstractConnectorCreator.getType("Main");
assertEquals(expectedType, actualType);
}
@Test
public void testGetTypeReject() {
EConnectionType expectedType = EConnectionType.REJECT;
EConnectionType actualType = AbstractConnectorCreator.getType("reject");
assertEquals(expectedType, actualType);
}
@Test
public void testGetTypeRejectUpperCase() {
EConnectionType expectedType = EConnectionType.REJECT;
EConnectionType actualType = AbstractConnectorCreator.getType("REJECT");
assertEquals(expectedType, actualType);
}
@Test
public void testGetNameDefault() {
String expectedName = EConnectionType.FLOW_MAIN.getName();
String actualName = AbstractConnectorCreator.getName(DEFAULT);
assertEquals(expectedName, actualName);
}
@Test
public void testGetNameAny() {
String expectedName = "Any";
String actualName = AbstractConnectorCreator.getName("Any");
assertEquals(expectedName, actualName);
}
}

View File

@@ -1,139 +0,0 @@
package org.talend.sdk.component.studio.model.parameter;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.metadata.MetadataColumn;
import org.talend.core.model.metadata.MetadataTable;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.sdk.component.studio.lang.Pair;
import org.talend.sdk.component.studio.model.action.IActionParameter;
public class OutputSchemaParameterTest {
private static final String CONNECTOR_NAME = "FLOW";
@Test
public void testCreateActionParameter() {
final Node nodeMock = mockNode(metadata());
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
final IActionParameter actionParameter = parameter.createActionParameter("param");
final Collection<Pair<String, String>> parameters = actionParameter.parameters();
assertEquals(2, parameters.size());
final Iterator<Pair<String, String>> iterator = parameters.iterator();
assertEquals(new Pair<String, String>("param[0]", "c1"), iterator.next());
assertEquals(new Pair<String, String>("param[1]", "c2"), iterator.next());
}
@Test
public void testGetValue() {
final Node nodeMock = mockNode(metadata());
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
assertEquals(Arrays.asList("c1", "c2"), parameter.getValue());
}
@Test
public void testGetValueNoMetadata() {
final Node nodeMock = mockNode(null);
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
assertEquals(Collections.emptyList(), parameter.getValue());
}
@Test
public void testGetStringValue() {
final Node nodeMock = mockNode(metadata());
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
assertEquals("[c1, c2]", parameter.getStringValue());
}
@Test
public void testGetStringValueNoMetadata() {
final Node nodeMock = mockNode(null);
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
assertEquals("[]", parameter.getStringValue());
}
@Test
public void testSetValue() {
final IMetadataTable metadata = new MetadataTable();
final Node nodeMock = mockNode(metadata);
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
final List<String> schema = Arrays.asList("c1", "c2", "c3");
parameter.setValue(schema);
assertEquals(3, metadata.getListColumns().size());
final List<String> actualLabels = metadata.getListColumns().stream()
.map(IMetadataColumn::getLabel)
.collect(Collectors.toList());
assertEquals(Arrays.asList("c1", "c2", "c3"), actualLabels);
final List<String> actualDbColumnNames = metadata.getListColumns().stream()
.map(IMetadataColumn::getOriginalDbColumnName)
.collect(Collectors.toList());
assertEquals(Arrays.asList("c1", "c2", "c3"), actualDbColumnNames);
final List<String> actualTypes = metadata.getListColumns().stream()
.map(IMetadataColumn::getTalendType)
.collect(Collectors.toList());
assertEquals(Arrays.asList("id_String", "id_String", "id_String"), actualTypes);
}
/**
* Check there is no exception in case of MetadataTable is missed
*/
@Test
public void testSetValueNoMetadata() {
final Node nodeMock = mockNode(null);
final OutputSchemaParameter parameter = new OutputSchemaParameter(nodeMock, "schema", CONNECTOR_NAME, null, true);
final List<String> schema = Arrays.asList("c1", "c2", "c3");
parameter.setValue(schema);
}
@Test
public void testIsPersisted() {
final OutputSchemaParameter parameter = new OutputSchemaParameter(null, "schema", CONNECTOR_NAME, null, true);
assertFalse(parameter.isPersisted());
}
@Test
public void testGuessButtonName() {
assertEquals("Guess Schema_config.datastore.dataset", OutputSchemaParameter.guessButtonName("config.datastore.dataset"));
}
private Node mockNode(final IMetadataTable metadata) {
final Node nodeMock = mock(Node.class);
when(nodeMock.getMetadataFromConnector(CONNECTOR_NAME)).thenReturn(metadata);
return nodeMock;
}
private IMetadataTable metadata() {
final IMetadataTable metadata = new MetadataTable();
final List<IMetadataColumn> columns = new ArrayList<>();
final IMetadataColumn c1 = new MetadataColumn();
c1.setLabel("c1");
columns.add(c1);
final IMetadataColumn c2 = new MetadataColumn();
c2.setLabel("c2");
columns.add(c2);
metadata.setListColumns(columns);
return metadata;
}
}

View File

@@ -1,171 +0,0 @@
// ============================================================================
//
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.sdk.component.studio.model.parameter;
import org.junit.jupiter.api.Assertions;
import org.junit.Test;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.sdk.component.studio.lang.Pair;
import org.talend.sdk.component.studio.model.action.IActionParameter;
import java.util.*;
public class TableElementParameterTest {
@Test
public void testCreateActionParameter() {
final List<Pair<String, String>> expected = new ArrayList<>();
final Pair<String, String> p1 = new Pair("t[0].id", "id value 0");
expected.add(p1);
final Pair<String, String> p2 = new Pair("t[0].name", "name 0");
expected.add(p2);
final Pair<String, String> p3 = new Pair("t[0].number", "number 0");
expected.add(p3);
final Pair<String, String> p4 = new Pair("t[1].id", "id value 1");
expected.add(p4);
final Pair<String, String> p5 = new Pair("t[1].name", "name 1");
expected.add(p5);
final Pair<String, String> p6 = new Pair("t[1].number", "number 1");
expected.add(p6);
final List<Map<String, String>> value = new ArrayList<>();
final Map<String, String> row1 = new LinkedHashMap<>();
row1.put("conf.table[].id", "id value 0");
row1.put("conf.table[].name", "name 0");
row1.put("conf.table[].number", "number 0");
value.add(row1);
final Map<String, String> row2 = new LinkedHashMap<>();
row2.put("conf.table[].id", "id value 1");
row2.put("conf.table[].name", "name 1");
row2.put("conf.table[].number", "number 1");
value.add(row2);
final TableElementParameter parameter = new TableElementParameter(null, Collections.emptyList());
parameter.setName("conf.table");
parameter.setValue(value);
final IActionParameter actionParameter = parameter.createActionParameter("t");
final Collection<Pair<String, String>> parameters = actionParameter.parameters();
Assertions.assertEquals(expected, parameters);
}
@Test
public void testCreateActionParameterNull() {
final List<Pair<String, String>> expected = new ArrayList<>();
final TableElementParameter parameter = new TableElementParameter(null, Collections.emptyList());
parameter.setName("conf.table");
final IActionParameter actionParameter = parameter.createActionParameter("t");
final Collection<Pair<String, String>> parameters = actionParameter.parameters();
Assertions.assertEquals(expected, parameters);
}
@Test
public void testCreateActionParameterEmpty() {
final List<Pair<String, String>> expected = new ArrayList<>();
final TableElementParameter parameter = new TableElementParameter(null, Collections.emptyList());
parameter.setName("conf.table");
parameter.setValue(new ArrayList<>());
final IActionParameter actionParameter = parameter.createActionParameter("t");
final Collection<Pair<String, String>> parameters = actionParameter.parameters();
Assertions.assertEquals(expected, parameters);
}
@Test
public void testSetValueFixClosedList() {
final List<Map<String, Object>> expectedValue = new ArrayList<>();
final Map<String, Object> expectedRow1 = new LinkedHashMap<>();
expectedRow1.put("conf.table[].check", "false");
expectedRow1.put("conf.table[].enum", "GREATER");
expectedValue.add(expectedRow1);
final CheckElementParameter col1 = new CheckElementParameter(null);
col1.setName("conf.table[].check");
col1.setFieldType(EParameterFieldType.CHECK);
final TaCoKitElementParameter col2 = new TaCoKitElementParameter(null);
final Object[] col2PossibleValues = new String[]{"GREATER", "LESS", "EQUALS"};
col2.setName("conf.table[].enum");
col2.setListItemsValue(col2PossibleValues);
col2.setFieldType(EParameterFieldType.CLOSED_LIST);
final TableElementParameter table = new TableElementParameter(null, Collections.emptyList());
final Object[] tableColumns = new Object[]{col1, col2};
table.setListItemsValue(tableColumns);
table.setName("conf.table");
final List<Map<String, Object>> newValue = new ArrayList<>();
final Map<String, Object> newRow1 = new LinkedHashMap<>();
newRow1.put("conf.table[].check", "false");
newRow1.put("conf.table[].enum", 0);
newValue.add(newRow1);
table.setValue(newValue);
Assertions.assertEquals(expectedValue, table.getValue());
}
@Test
public void testSetValueFromAction() {
final List<Map<String, Object>> expectedValue = new ArrayList<Map<String, Object>>();
final Map<String, Object> row1 = new HashMap<>();
row1.put("conf.updatableConfig.table[].check", true);
row1.put("conf.updatableConfig.table[].number", "1");
row1.put("conf.updatableConfig.table[].operator", "GREATER");
row1.put("conf.updatableConfig.table[].strColumn", "Talend");
expectedValue.add(row1);
final Map<String, Object> row2 = new HashMap<>();
row2.put("conf.updatableConfig.table[].check", false);
row2.put("conf.updatableConfig.table[].number", "2");
row2.put("conf.updatableConfig.table[].operator", "LESS");
row2.put("conf.updatableConfig.table[].strColumn", "The best");
expectedValue.add(row2);
final TableElementParameter table = new TableElementParameter(null, Collections.emptyList());
table.setName("conf.updatableConfig.table");
table.setFieldType(EParameterFieldType.TABLE);
final TaCoKitElementParameter column1 = new TaCoKitElementParameter(null);
column1.setFieldType(EParameterFieldType.CHECK);
column1.setName("conf.updatableConfig.table[].check");
final TaCoKitElementParameter column2 = new TaCoKitElementParameter(null);
column2.setFieldType(EParameterFieldType.TEXT);
column2.setName("conf.updatableConfig.table[].number");
final TaCoKitElementParameter column3 = new TaCoKitElementParameter(null);
column3.setFieldType(EParameterFieldType.CLOSED_LIST);
column3.setName("conf.updatableConfig.table[].operator");
final TaCoKitElementParameter column4 = new TaCoKitElementParameter(null);
column4.setFieldType(EParameterFieldType.TEXT);
column4.setName("conf.updatableConfig.table[].strColumn");
table.setListItemsValue(new Object[] {column1, column2, column3, column4});
final List<Object> tableValue = new ArrayList<>();
final Map<String, Object> tableRow1 = new HashMap<>();
tableRow1.put("check", true);
tableRow1.put("number", 1);
tableRow1.put("operator", "GREATER");
tableRow1.put("strColumn", "Talend");
tableValue.add(tableRow1);
final Map<String, Object> tableRow2 = new HashMap<>();
tableRow2.put("check", false);
tableRow2.put("number", 2);
tableRow2.put("operator", "LESS");
tableRow2.put("strColumn", "The best");
tableValue.add(tableRow2);
table.setValueFromAction(tableValue);
Assertions.assertEquals(expectedValue, table.getValue());
}
}

View File

@@ -1,62 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.model.parameter;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Test;
/**
* Unit-tests for {@link ValueConverter}
*/
public class ValueConverterTest {
@Test
public void testToTable() {
Map<String, Object> expected0 = new HashMap<>();
expected0.put("key1", "value11");
expected0.put("key2", "value12");
Map<String, Object> expected1 = new HashMap<>();
expected1.put("key1", "value21");
expected1.put("key2", "value22");
String table = "[{key1=value11, key2=value12}, {key1=value21, key2=value22}]";
List<Map<String, Object>> converted = ValueConverter.toTable(table);
assertEquals(2, converted.size());
assertEquals(expected0, converted.get(0));
assertEquals(expected1, converted.get(1));
}
@Test
public void testToTableNull() {
ArrayList<Map<String, Object>> empty = new ArrayList<>();
List<Map<String, Object>> actual = ValueConverter.toTable(null);
assertEquals(empty, actual);
}
@Test
public void testToTableEmpty() {
ArrayList<Map<String, Object>> empty = new ArrayList<>();
List<Map<String, Object>> actual = ValueConverter.toTable("");
assertEquals(empty, actual);
}
}

View File

@@ -1,153 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.model.parameter.listener;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.beans.PropertyChangeEvent;
import java.util.HashMap;
import org.junit.Test;
import org.talend.sdk.component.studio.model.parameter.PropertyDefinitionDecorator.Condition;
import org.talend.sdk.component.studio.model.parameter.TaCoKitElementParameter;
import org.talend.sdk.component.studio.model.parameter.TextElementParameter;
import org.talend.sdk.component.studio.model.parameter.condition.ConditionGroup;
// todo: check why these tests are correct, seems it happens on the property change
// and not the relational conditions changes
public class ActiveIfListenerTest {
@Test
public void containsNegative() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
singletonList(new Condition(new String[] { "A" }, "a", false, "contains")), true)),
param, singletonMap("a", new TacokitTestParameter("foo")))
.propertyChange(new PropertyChangeEvent(param, "value", "bar", "foo"));
assertFalse(param.setShowValue);
}
@Test
public void contains() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
singletonList(new Condition(new String[] { "A" }, "a", false, "contains")), true)),
param, singletonMap("a", new TacokitTestParameter("bAr")))
.propertyChange(new PropertyChangeEvent(param, "value", "foo", "bAr"));
assertTrue(param.setShowValue);
}
@Test
public void containsLowercase() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
singletonList(new Condition(
new String[] { "a" }, "a", false, "contains(lowercase=true)")), true)),
param, singletonMap("a", new TacokitTestParameter("bAR")))
.propertyChange(new PropertyChangeEvent(param, "value", "foo", "bAr"));
assertTrue(param.setShowValue);
}
@Test
public void notActivatedCondition() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
singletonList(new Condition(new String[] { "A" }, "a", false, "DEFAULT")), true)),
param, singletonMap("a", new TacokitTestParameter("C")))
.propertyChange(new PropertyChangeEvent(param, "value", "foo", "bar"));
assertFalse(param.setShowValue);
}
@Test
public void singleCondition() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
singletonList(new Condition(new String[] { "A" }, "a", false, "DEFAULT")), true)),
param, singletonMap("a", new TacokitTestParameter("A")))
.propertyChange(new PropertyChangeEvent(param, "value", "foo", "bar"));
assertTrue(param.setShowValue);
}
@Test
public void andCondition() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
asList(
new Condition(new String[] { "A" }, "a", false, "DEFAULT"),
new Condition(new String[] { "B" }, "b", false, "DEFAULT")),
true)),
param, new HashMap<String, TaCoKitElementParameter>() {{
put("a", new TacokitTestParameter("A"));
put("b", new TacokitTestParameter("B"));
}}).propertyChange(new PropertyChangeEvent(param, "value", "foo", "bar"));
assertTrue(param.setShowValue);
}
@Test
public void orCondition() {
final TacokitTestParameter param = new TacokitTestParameter("-");
new ActiveIfListener(singletonList(
new ConditionGroup(
asList(
new Condition(new String[] { "A" }, "a", false, "DEFAULT"),
new Condition(new String[] { "B" }, "b", false, "DEFAULT")),
false)),
param, new HashMap<String, TaCoKitElementParameter>() {{
put("a", new TacokitTestParameter("A"));
put("b", new TacokitTestParameter("C"));
}}).propertyChange(new PropertyChangeEvent(param, "value", "foo", "bar"));
assertTrue(param.setShowValue);
}
private static class TacokitTestParameter extends TextElementParameter {
private final String value;
private boolean setShowValue;
private TacokitTestParameter(final String value) {
super(null);
this.value = value;
}
@Override
public String getValue() {
return value;
}
@Override
public void setShow(boolean show) {
this.setShowValue = show;
}
@Override
public void redraw() {
// no-op
}
@Override
public void firePropertyChange(final String name, final Object oldValue, final Object newValue) {
// no-op
}
}
}

View File

@@ -1,70 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.model.parameter.listener;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collection;
import java.util.stream.Stream;
import org.junit.Test;
import org.talend.sdk.component.studio.model.parameter.ValidationLabel;
public class PatternValidatorTest {
@Test
public void simpleRegex() {
Stream.of(
new RegexCases("\\S+@\\S+\\.\\S+", asList("foo@bar.com", "test.thing@dummy.provider.com"),
asList("wrong", "notgoodgmail.com")),
new RegexCases("^[a-zA-Z ]+$", asList("John Doe", "Some other Name"),
asList("@bsolutely wrong", "Not a Name v3")))
.flatMap(base -> Stream.of(base, new RegexCases("/^" + base.regex + "$/", base.validTexts, base.invalidTexts)))
.forEach(Runnable::run);
}
@Test
public void withFlags() {
new RegexCases("/[a-z]+/i", asList("foo", "FOO", "FoO"), asList("123", "@")).run();
}
private static class RegexCases implements Runnable {
private final PatternValidator regex;
private final Collection<String> validTexts;
private final Collection<String> invalidTexts;
private RegexCases(final String regex, final Collection<String> validTexts, final Collection<String> invalidTexts) {
this.regex = new PatternValidator(new ValidationLabel(null), regex);
this.validTexts = validTexts;
this.invalidTexts = invalidTexts;
}
@Override
public void run() {
validTexts.forEach(v -> validate(v, true));
invalidTexts.forEach(v -> validate(v, false));
}
private void validate(final String value, final boolean state) {
assertEquals(state, regex.validate(value), "Error in validating " + regex + " > " + value);
}
}
}

View File

@@ -1,16 +0,0 @@
package org.talend.sdk.component.studio.service;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.Test;
public class AsciidoctorServiceTest {
@Test
public void init() {
final AsciidoctorService instance = new AsciidoctorService();
String result = instance.convert("= Header");
assertEquals("<h1>Header</h1>",result.trim());
}
}

View File

@@ -1,101 +0,0 @@
/**
* Copyright (C) 2006-2019 Talend Inc. - www.talend.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.talend.sdk.component.studio.test;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import javax.json.bind.annotation.JsonbCreator;
import javax.json.bind.annotation.JsonbProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.talend.core.model.process.IElementParameter;
import org.talend.sdk.component.server.front.model.ActionReference;
import org.talend.sdk.component.server.front.model.SimplePropertyDefinition;
import org.talend.sdk.component.studio.model.parameter.PropertyNode;
import org.talend.sdk.component.studio.model.parameter.TaCoKitElementParameter;
public class TestComponent {
public static final Logger LOG = LoggerFactory.getLogger(TestComponent.class);
private List<ActionReference> actions;
private String name;
private List<PropertyNode> nodes;
private List<SimplePropertyDefinition> properties;
private List<TaCoKitElementParameter> settings;
public static TestComponent load(final String resource) throws Exception {
try (final Jsonb jsonb = JsonbBuilder.create();
final InputStream stream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)) {
return jsonb.fromJson(stream, TestComponent.class);
}
}
@JsonbCreator
public TestComponent(@JsonbProperty("actions") final List<ActionReference> actions,
@JsonbProperty("name") final String name,
@JsonbProperty("properties") final List<SimplePropertyDefinition> properties,
@JsonbProperty("nodes") final List<PropertyNode> nodes,
@JsonbProperty("settings") final List<TaCoKitElementParameter> settings) {
this.actions = actions;
this.name = name;
this.properties = properties;
this.nodes = nodes;
this.settings = settings;
}
public String getName() {
return name;
}
public ActionReference getAction(final String name) {
return actions.stream()
.filter(a -> name.equals(a.getName()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("no action with name " + name));
}
public List<ActionReference> getActions() {
return new ArrayList<>(this.actions);
}
public PropertyNode getNode(final String name) {
return nodes.stream()
.filter(p -> name.equals(p.getProperty().getPath()))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("no property with name " + name));
}
public Map<String, IElementParameter> getSettings() {
final Map<String, IElementParameter> result = new HashMap<>();
settings.forEach(p -> {
result.put(p.getName(), p);
});
return result;
}
}