Compare commits
31 Commits
release/7.
...
bugfix/mas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4687a7ffec | ||
|
|
65b467f574 | ||
|
|
e0199336ef | ||
|
|
f807ca1839 | ||
|
|
8a8d5eeb0a | ||
|
|
c968ed321c | ||
|
|
394a29cca2 | ||
|
|
c6696371b2 | ||
|
|
3b582b21fc | ||
|
|
fa88cc5613 | ||
|
|
da2413c87c | ||
|
|
a1ea92865b | ||
|
|
acce4c5e8f | ||
|
|
7ce62fc066 | ||
|
|
7f26a779bc | ||
|
|
70bfd5623b | ||
|
|
97dd532fdd | ||
|
|
c9de20238c | ||
|
|
857f5459b6 | ||
|
|
76aa39dbd8 | ||
|
|
e68d27d598 | ||
|
|
4abb63f274 | ||
|
|
4ad69a33d9 | ||
|
|
dd1853cf85 | ||
|
|
20656380ab | ||
|
|
43021956a4 | ||
|
|
8bafc9ace7 | ||
|
|
63f5588fec | ||
|
|
737e502767 | ||
|
|
da191288c5 | ||
|
|
f45a5ce571 |
@@ -18,6 +18,7 @@ import org.eclipse.jface.util.Assert;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ComboBoxCellEditor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CCombo;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
import org.eclipse.swt.events.KeyAdapter;
|
||||
@@ -27,7 +28,6 @@ import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.TraverseEvent;
|
||||
import org.eclipse.swt.events.TraverseListener;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ComboxCellEditorImproved extends CellEditor {
|
||||
/**
|
||||
* The custom combo box control.
|
||||
*/
|
||||
Combo comboBox;
|
||||
CCombo comboBox;
|
||||
|
||||
/**
|
||||
* Default ComboBoxCellEditor style
|
||||
@@ -125,7 +125,7 @@ public class ComboxCellEditorImproved extends CellEditor {
|
||||
*/
|
||||
protected Control createControl(Composite parent) {
|
||||
|
||||
comboBox = new Combo(parent, getStyle());
|
||||
comboBox = new CCombo(parent, getStyle());
|
||||
comboBox.setFont(parent.getFont());
|
||||
|
||||
comboBox.addKeyListener(new KeyAdapter() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.talend.utils.security.AESEncryption;
|
||||
|
||||
/**
|
||||
* DOC chuang class global comment. Detailled comment
|
||||
@@ -85,20 +86,6 @@ public class PasswordEncryptUtil {
|
||||
return new String(clearByte);
|
||||
}
|
||||
|
||||
private static SecretKey passwordKey = null;
|
||||
|
||||
private static String CHARSET = "UTF-8";
|
||||
|
||||
private static SecretKey getSecretKeyUTF8() throws Exception {
|
||||
if (passwordKey == null) {
|
||||
byte rawKeyData[] = rawKey.getBytes(CHARSET);
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
passwordKey = keyFactory.generateSecret(dks);
|
||||
}
|
||||
return passwordKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Work for codegen only. and must be same as the routine
|
||||
* "routines.system.PasswordEncryptUtil.encryptPassword(input)".
|
||||
@@ -108,12 +95,7 @@ public class PasswordEncryptUtil {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
SecretKey key = getSecretKeyUTF8();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
|
||||
byte[] cipherByte = c.doFinal(input.getBytes(CHARSET));
|
||||
String dec = Hex.encodeHexString(cipherByte);
|
||||
return dec;
|
||||
return AESEncryption.encryptPassword(input);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,5 +141,4 @@ public class PasswordEncryptUtil {
|
||||
return value.replaceAll(".", "*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,10 +15,13 @@ package org.talend.commons.utils;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
@@ -26,6 +29,8 @@ import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
|
||||
/**
|
||||
@@ -213,6 +218,40 @@ public class VersionUtils {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String getMojoVersion(String mojoKey) {
|
||||
String version = null;
|
||||
String talendVersion = getTalendVersion();
|
||||
Properties properties = new Properties();
|
||||
File file = new Path(Platform.getConfigurationLocation().getURL().getPath()).append("mojo_version.properties").toFile(); //$NON-NLS-1$
|
||||
if (file.exists()) {
|
||||
try (InputStream inStream = new FileInputStream(file)) {
|
||||
properties.load(inStream);
|
||||
version = properties.getProperty(mojoKey);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (version != null && !version.startsWith(talendVersion)) {
|
||||
ExceptionHandler
|
||||
.process(new Exception(
|
||||
"Incompatible Mojo version:" + mojoKey + "[" + version + "], use default version.")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
version = null;
|
||||
}
|
||||
}
|
||||
// default version
|
||||
if (StringUtils.isBlank(version)) {
|
||||
version = talendVersion;
|
||||
if (CommonsPlugin.isJUnitTest()) {
|
||||
productVersion = null;
|
||||
}
|
||||
String productVersion = getInternalVersion();
|
||||
String revision = StringUtils.substringAfterLast(productVersion, "-"); //$NON-NLS-1$
|
||||
if (("SNAPSHOT").equals(revision) || Pattern.matches("M\\d{1}", revision)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
version += "-" + revision; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
synchronized (VersionUtils.class) {
|
||||
productVersion = null;
|
||||
|
||||
@@ -42,13 +42,15 @@ public class NetworkUtil {
|
||||
|
||||
private static final String TALEND_DISABLE_INTERNET = "talend.disable.internet";//$NON-NLS-1$
|
||||
|
||||
private static final String HTTP_NETWORK_URL = "https://talend-update.talend.com";
|
||||
|
||||
public static boolean isNetworkValid() {
|
||||
String disableInternet = System.getProperty(TALEND_DISABLE_INTERNET);
|
||||
if ("true".equals(disableInternet)) { //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
URL url = new URL("https://www.talend.com"); //$NON-NLS-1$
|
||||
URL url = new URL(HTTP_NETWORK_URL);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(4000);
|
||||
conn.setReadTimeout(4000);
|
||||
|
||||
@@ -22,15 +22,15 @@ import java.security.Security;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
|
||||
/**
|
||||
* This class is used for LDAP. <br/>
|
||||
*
|
||||
@@ -218,12 +218,12 @@ public class AdvancedSocketFactory extends SSLSocketFactory {
|
||||
*/
|
||||
private void init(KeyStore ks, char password[]) {
|
||||
SSLContext ctx = null;
|
||||
javax.net.ssl.KeyManager keyManagers[] = null;
|
||||
KeyManager keyManagers[] = null;
|
||||
TrustManager trustManagers[] = null;
|
||||
try {
|
||||
if (ks != null) {
|
||||
KeyManagerFactory kmf = null;
|
||||
kmf = KeyManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
kmf.init(ks, password);
|
||||
keyManagers = kmf.getKeyManagers();
|
||||
}
|
||||
@@ -236,7 +236,4 @@ public class AdvancedSocketFactory extends SSLSocketFactory {
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Security.addProvider(java.security.Security.getProvider("SUN"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
|
||||
/**
|
||||
* This class is used for verifying CA for LDAP connection.
|
||||
*
|
||||
@@ -76,6 +76,26 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment method "deleteCert".
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean deleteCert(String id) {
|
||||
try {
|
||||
ks.deleteEntry(id);
|
||||
} catch (KeyStoreException ex) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers()
|
||||
*/
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
if (trustManager == null)
|
||||
return null;
|
||||
@@ -157,9 +177,9 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
*/
|
||||
private X509TrustManager initTrustManager(KeyStore ks) throws NoSuchAlgorithmException, KeyStoreException {
|
||||
TrustManagerFactory trustManagerFactory = null;
|
||||
trustManagerFactory = TrustManagerFactory.getInstance("SunX509"); //$NON-NLS-1$
|
||||
trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); //$NON-NLS-1$
|
||||
trustManagerFactory.init(ks);
|
||||
javax.net.ssl.TrustManager trusts[] = trustManagerFactory.getTrustManagers();
|
||||
TrustManager trusts[] = trustManagerFactory.getTrustManagers();
|
||||
return (X509TrustManager) trusts[0];
|
||||
}
|
||||
|
||||
@@ -174,29 +194,28 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.sun.net.ssl.X509TrustManager#isServerTrusted(java.security.cert.X509Certificate[])
|
||||
*/
|
||||
public boolean isServerTrusted(X509Certificate chain[], String authType) {
|
||||
boolean isTrusted = false;
|
||||
if (trustManager != null) {
|
||||
try {
|
||||
trustManager.checkServerTrusted(chain, authType);
|
||||
isTrusted = true;
|
||||
}catch (CertificateException e) {
|
||||
ExceptionHandler.process(e);
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager == null)
|
||||
throw new CertificateException("Trust manager is not initialized");
|
||||
else
|
||||
trustManager.checkClientTrusted(chain, authType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager != null) {
|
||||
try {
|
||||
trustManager.checkServerTrusted(chain, authType);
|
||||
return;
|
||||
} catch(Exception e) {
|
||||
}
|
||||
}
|
||||
if (isTrusted) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
X509Certificate ca = getCACert(chain);
|
||||
if (ca != null) {
|
||||
if (isAccepted(ca)) {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError1")); //$NON-NLS-1$
|
||||
return false;
|
||||
if (!isAccepted(ca)) {
|
||||
System.err.println("SSL Error:Server certificate chain verification failed.");
|
||||
throw new CertificateException("Server certificate chain verification failed.");
|
||||
}
|
||||
String id = String.valueOf(System.currentTimeMillis());
|
||||
X509TrustManager tmpTrustManager = null;
|
||||
@@ -204,34 +223,26 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
ks.setCertificateEntry(id, ca);
|
||||
tmpTrustManager = initTrustManager(ks);
|
||||
} catch (Exception e) {
|
||||
log.error(Messages.getString("LDAPCATruster.failedCreateTmp") + e.getMessage()); //$NON-NLS-1$
|
||||
return false;
|
||||
System.err.println("ASF Truster: Failed to create tmp trust store : " + e.getMessage());
|
||||
throw new CertificateException(e);
|
||||
}
|
||||
boolean isTmpTrusted = false;
|
||||
if (tmpTrustManager != null) {
|
||||
try {
|
||||
tmpTrustManager.checkServerTrusted(chain, authType);
|
||||
isTmpTrusted = true;
|
||||
}catch (CertificateException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (isTmpTrusted) {
|
||||
try{
|
||||
tmpTrustManager.checkServerTrusted(chain, authType);
|
||||
if (this.isSaveCA) {
|
||||
saveStore();
|
||||
trustManager = tmpTrustManager;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError2")); //$NON-NLS-1$
|
||||
return false;
|
||||
return;
|
||||
} catch(CertificateException e) {
|
||||
System.err.println("SSL Error:Server certificate chain verification failed and \\nthe CA is missing.");
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
log.error(Messages.getString("LDAPCATruster.sslError3") //$NON-NLS-1$
|
||||
+ Messages.getString("LDAPCATruster.noCertificate")); //$NON-NLS-1$
|
||||
return false;
|
||||
System.err
|
||||
.println("SSL Error:CA certificate is not in the server certificate chain.\nPlease use the keytool command to import the server certificate.");
|
||||
throw new CertificateException("CA certificate is not in the server certificate chain.\\nPlease use the keytool command to import the server certificate.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment method "saveStore".
|
||||
@@ -266,18 +277,4 @@ public class LDAPCATruster implements X509TrustManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (trustManager == null) {
|
||||
throw new CertificateException(Messages.getString("LDAPCATruster.failedInitialTrust"));
|
||||
}
|
||||
trustManager.checkClientTrusted(chain, authType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
|
||||
if (!isServerTrusted(chain, authType)) {
|
||||
throw new CertificateException(Messages.getString("LDAPCATruster.sslError1"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,11 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
@@ -274,20 +277,37 @@ public class ProjectDataJsonProvider {
|
||||
|
||||
public static void loadMigrationTaskSetting(Project project, InputStream input) throws PersistenceException {
|
||||
try {
|
||||
project.eSetDeliver(false);
|
||||
MigrationTaskSetting migrationTaskSetting = null;
|
||||
if (input != null) {
|
||||
migrationTaskSetting = new ObjectMapper().readValue(input, MigrationTaskSetting.class);
|
||||
}
|
||||
if (migrationTaskSetting != null) {
|
||||
MigrationTask fakeTask = createFakeMigrationTask();
|
||||
List<MigrationTask> allRealTask = new ArrayList<MigrationTask>();
|
||||
MigrationTask existingFakeTask = null;
|
||||
for (int i = 0; i < project.getMigrationTask().size(); i++) {
|
||||
MigrationTask task = (MigrationTask) project.getMigrationTask().get(i);
|
||||
if (!StringUtils.equals(fakeTask.getId(), task.getId())) {
|
||||
allRealTask.add(task);
|
||||
if (StringUtils.equals(fakeTask.getId(), task.getId())) {
|
||||
existingFakeTask = task;
|
||||
break;
|
||||
}
|
||||
}
|
||||
project.getMigrationTask().removeAll(allRealTask);
|
||||
// remove all the migrations from the project
|
||||
project.getMigrationTask().clear();
|
||||
if (existingFakeTask != null) {
|
||||
// keep only the fake migration task of 7.1.1 with new migration index
|
||||
// re-use the same instance to make sure we keep the same emf id.
|
||||
project.getMigrationTask().add(existingFakeTask);
|
||||
}
|
||||
Set<String> tasksIds = new HashSet<>();
|
||||
Iterator<MigrationTaskJson> it = migrationTaskSetting.getMigrationTaskList().iterator();
|
||||
while (it.hasNext()) { // remove duplicates to fix issues found in TUP-22735
|
||||
MigrationTaskJson task = it.next();
|
||||
if (tasksIds.contains(task.getId())) {
|
||||
it.remove();
|
||||
}
|
||||
tasksIds.add(task.getId());
|
||||
}
|
||||
project.getMigrationTasks().clear();
|
||||
if (migrationTaskSetting.getMigrationTaskList() != null) {
|
||||
for (MigrationTaskJson json : migrationTaskSetting.getMigrationTaskList()) {
|
||||
@@ -305,6 +325,7 @@ public class ProjectDataJsonProvider {
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
} finally {
|
||||
project.eSetDeliver(true);
|
||||
closeInputStream(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<dbType type="DOUBLE PRECISION" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="INTERVAL DAY TO SECOND" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="INTERVAL YEAR TO MONTH" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="BINARY" ignorePre="true"/>
|
||||
<dbType type="VARBINARY" ignorePre="true" />
|
||||
<dbType type="NUMERIC" defaultLength="10" defaultPrecision="5"/>
|
||||
@@ -46,6 +48,8 @@
|
||||
<talendType type="id_Date">
|
||||
<dbType type="DATE" default="true" />
|
||||
<dbType type="TIMESTAMP"/>
|
||||
<dbType type="INTERVAL DAY TO SECOND"/>
|
||||
<dbType type="INTERVAL YEAR TO MONTH"/>
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="DOUBLE PRECISION" default="true" />
|
||||
@@ -121,6 +125,12 @@
|
||||
<dbType type="TIMESTAMP">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL DAY TO SECOND">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL YEAR TO MONTH">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BINARY">
|
||||
<talendType type="id_byte[]" default="true" />
|
||||
</dbType>
|
||||
|
||||
@@ -163,9 +163,9 @@ public enum EDatabaseVersion4Drivers {
|
||||
MAPRDB(new DbVersion4Drivers(EDatabaseTypeName.MAPRDB, new String[] {})),
|
||||
|
||||
REDSHIFT(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT, "redshift", "REDSHIFT", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
"redshiftJDBC42-no-awssdk-1.2.16.1027.jar")), //$NON-NLS-1$
|
||||
"redshift-jdbc42-no-awssdk-1.2.20.1043.jar")), //$NON-NLS-1$
|
||||
REDSHIFT_SSO(new DbVersion4Drivers(EDatabaseTypeName.REDSHIFT_SSO, "redshift sso", "REDSHIFT_SSO", //$NON-NLS-1$ //$NON-NLS-2$
|
||||
new String[] { "redshiftJDBC42-no-awssdk-1.2.16.1027.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
new String[] { "redshift-jdbc42-no-awssdk-1.2.20.1043.jar", "aws-java-sdk-1.11.406.jar", "jackson-core-2.9.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"jackson-databind-2.9.5.jar", "jackson-annotations-2.9.0.jar", "httpcore-4.4.9.jar", "httpclient-4.5.5.jar", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$//$NON-NLS-4$
|
||||
"joda-time-2.8.1.jar", "commons-logging-1.1.3.jar" })), //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public interface IComponentsFactory {
|
||||
*/
|
||||
public Set<IComponent> getComponents();
|
||||
|
||||
public boolean isInitialising();
|
||||
|
||||
/**
|
||||
* Get a readonly components collection to avoid ConcurrentModificationException caused by multiple thread
|
||||
* access;<br/>
|
||||
|
||||
@@ -162,7 +162,8 @@ public final class MetadataToolHelper {
|
||||
if (itemId == null || itemId.equals("")) { //$NON-NLS-1$
|
||||
return null;
|
||||
}
|
||||
final IProxyRepositoryFactory proxyRepositoryFactory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
final IProxyRepositoryFactory proxyRepositoryFactory =
|
||||
CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
try {
|
||||
final IRepositoryViewObject lastVersion = proxyRepositoryFactory.getLastVersion(itemId);
|
||||
if (lastVersion != null) {
|
||||
@@ -280,7 +281,8 @@ public final class MetadataToolHelper {
|
||||
|
||||
private static boolean isAllowSpecificCharacters() {
|
||||
IEclipsePreferences coreUIPluginNode = new InstanceScope().getNode(ITalendCorePrefConstants.CoreUIPlugin_ID);
|
||||
return coreUIPluginNode.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
return coreUIPluginNode
|
||||
.getBoolean(IRepositoryPrefConstants.ALLOW_SPECIFIC_CHARACTERS_FOR_SCHEMA_COLUMNS, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -317,8 +319,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isKeyword
|
||||
|| org.apache.commons.lang.StringUtils.countMatches(returnedColumnName, underLine) > (originalColumnName.length() / 2)) {
|
||||
if (isKeyword || org.apache.commons.lang.StringUtils
|
||||
.countMatches(returnedColumnName, underLine) > (originalColumnName.length() / 2)) {
|
||||
returnedColumnName = "Column" + index; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -440,9 +442,9 @@ public final class MetadataToolHelper {
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static String mapSpecialChar(String columnName) {
|
||||
private static String mapSpecialChar(String columnName) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRoutinesService.class)) {
|
||||
IRoutinesService service = (IRoutinesService) GlobalServiceRegister.getDefault().getService(IRoutinesService.class);
|
||||
IRoutinesService service = GlobalServiceRegister.getDefault().getService(IRoutinesService.class);
|
||||
if (service != null) {
|
||||
Vector map = service.getAccents();
|
||||
map.setElementAt("AE", 4);//$NON-NLS-1$
|
||||
@@ -491,13 +493,15 @@ public final class MetadataToolHelper {
|
||||
*/
|
||||
public static void validateSchema(String value) {
|
||||
if (value == null) {
|
||||
MessageDialog.openError(Display.getCurrent().getActiveShell(),
|
||||
Messages.getString("MetadataTool.nullValue"), Messages.getString("MetadataTool.nameNull")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(Display.getCurrent().getActiveShell(), Messages.getString("MetadataTool.nullValue"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.nameNull")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
if (!isValidSchemaName(value)) {
|
||||
MessageDialog.openError(Display.getCurrent().getActiveShell(),
|
||||
Messages.getString("MetadataTool.invalid"), Messages.getString("MetadataTool.schemaInvalid")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(Display.getCurrent().getActiveShell(), Messages.getString("MetadataTool.invalid"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.schemaInvalid")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -533,8 +537,9 @@ public final class MetadataToolHelper {
|
||||
public static void checkSchema(Shell shell, KeyEvent event) {
|
||||
if ((!Character.isIdentifierIgnorable(event.character)) && (event.character == ' ')) {
|
||||
event.doit = false;
|
||||
MessageDialog.openError(shell,
|
||||
Messages.getString("MetadataTool.invalidChar"), Messages.getString("MetadataTool.errorMessage")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
MessageDialog
|
||||
.openError(shell, Messages.getString("MetadataTool.invalidChar"), //$NON-NLS-1$
|
||||
Messages.getString("MetadataTool.errorMessage")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,6 +584,11 @@ public final class MetadataToolHelper {
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput) {
|
||||
copyTable(source, target, targetDbms, avoidUsedColumnsFromInput, false);
|
||||
}
|
||||
|
||||
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
|
||||
boolean avoidUsedColumnsFromInput, boolean withCustoms) {
|
||||
if (source == null || target == null) {
|
||||
return;
|
||||
}
|
||||
@@ -598,10 +608,11 @@ public final class MetadataToolHelper {
|
||||
List<IMetadataColumn> columnsTAdd = new ArrayList<IMetadataColumn>();
|
||||
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput)) {
|
||||
IMetadataColumn targetColumn = target.getColumn(column.getLabel());
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
IMetadataColumn newTargetColumn = column.clone(withCustoms);
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -614,12 +625,13 @@ public final class MetadataToolHelper {
|
||||
target.getListColumns().addAll(columnsTAdd);
|
||||
target.sortCustomColumns();
|
||||
target.setLabel(source.getLabel());
|
||||
List<String> originalColumnsList = null;
|
||||
if (source.getOriginalColumns() != null) {
|
||||
originalColumnsList = new ArrayList<String>();
|
||||
originalColumnsList.addAll(source.getOriginalColumns());
|
||||
}
|
||||
target.setOriginalColumns(originalColumnsList);
|
||||
target.setOriginalColumns(source.getOriginalColumns());
|
||||
// List<String> originalColumnsList = null;
|
||||
// if (source.getOriginalColumns() != null) {
|
||||
// originalColumnsList = new ArrayList<String>();
|
||||
// originalColumnsList.addAll(source.getOriginalColumns());
|
||||
// }
|
||||
// target.setOriginalColumns(originalColumnsList);
|
||||
Map<String, String> targetProperties = target.getAdditionalProperties();
|
||||
Map<String, String> sourceProperties = source.getAdditionalProperties();
|
||||
for (Entry<String, String> entry : sourceProperties.entrySet()) {
|
||||
@@ -627,7 +639,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyTable(List<IMetadataColumn> sourceColumns, IMetadataTable target, List<IMetadataColumn> targetColumns) {
|
||||
public static void copyTable(List<IMetadataColumn> sourceColumns, IMetadataTable target,
|
||||
List<IMetadataColumn> targetColumns) {
|
||||
if (sourceColumns == null || target == null || targetColumns == null) {
|
||||
return;
|
||||
}
|
||||
@@ -649,7 +662,8 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -704,7 +718,8 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn newTargetColumn = column.clone();
|
||||
if (targetColumn == null) {
|
||||
columnsTAdd.add(newTargetColumn);
|
||||
newTargetColumn.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
newTargetColumn
|
||||
.setReadOnly(target.isReadOnly() || readOnlycolumns.contains(newTargetColumn.getLabel()));
|
||||
} else {
|
||||
if (!targetColumn.isReadOnly()) {
|
||||
target.getListColumns().remove(targetColumn);
|
||||
@@ -750,9 +765,9 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
Set<MetadataTable> tables = null;
|
||||
IGenericWizardService wizardService = null;
|
||||
if (!CommonsPlugin.isHeadless() && GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (!CommonsPlugin.isHeadless()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
wizardService = GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null && wizardService.isGenericConnection(connection)) {
|
||||
List<MetadataTable> metadataTables = wizardService.getMetadataTables(connection);
|
||||
@@ -778,7 +793,8 @@ public final class MetadataToolHelper {
|
||||
* @param tableName
|
||||
* @return
|
||||
*/
|
||||
public static MetadataTable getMetadataTableFromSAPFunction(String connectionId, String functionId, String tableName) {
|
||||
public static MetadataTable getMetadataTableFromSAPFunction(String connectionId, String functionId,
|
||||
String tableName) {
|
||||
org.talend.core.model.metadata.builder.connection.Connection connection;
|
||||
if (connectionId != null) {
|
||||
connection = getConnectionFromRepository(connectionId);
|
||||
@@ -850,7 +866,8 @@ public final class MetadataToolHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static org.talend.core.model.metadata.builder.connection.Connection getConnectionFromRepository(String metaRepositoryid) {
|
||||
public static org.talend.core.model.metadata.builder.connection.Connection
|
||||
getConnectionFromRepository(String metaRepositoryid) {
|
||||
ConnectionItem connItem = getConnectionItemFromRepository(metaRepositoryid);
|
||||
if (connItem != null) {
|
||||
return connItem.getConnection();
|
||||
@@ -916,9 +933,9 @@ public final class MetadataToolHelper {
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// private static final String VALIDATE_PATTERN_NAME = "^[a-zA-Z_][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
// private static final String VALIDATE_PATTERN_NAME = "^[a-zA-Z_][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
|
||||
// private static final String VALIDATE_PATTERN_SCHEMA_NAME = "^[a-zA-Z_0-9][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
// private static final String VALIDATE_PATTERN_SCHEMA_NAME = "^[a-zA-Z_0-9][a-zA-Z_0-9]*$"; //$NON-NLS-1$
|
||||
|
||||
public static List<ColumnNameChanged> getColumnNameChanged(IMetadataTable oldTable, IMetadataTable newTable) {
|
||||
List<ColumnNameChanged> columnNameChanged = new ArrayList<ColumnNameChanged>();
|
||||
@@ -949,8 +966,9 @@ public final class MetadataToolHelper {
|
||||
IMetadataColumn clonedColumn = getColumn(newTable, originalColumn, oldIndex);
|
||||
if (clonedColumn != null) {
|
||||
if (!originalColumn.getLabel().equals(clonedColumn.getLabel())) {
|
||||
columnNameChanged.add(new ColumnNameChangedExt(changedNode, originalColumn.getLabel(), clonedColumn
|
||||
.getLabel()));
|
||||
columnNameChanged
|
||||
.add(new ColumnNameChangedExt(changedNode, originalColumn.getLabel(),
|
||||
clonedColumn.getLabel()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1099,8 +1117,8 @@ public final class MetadataToolHelper {
|
||||
initilializeNewSchema(metadataTable, mappingParameter, param);
|
||||
if (!param.getDefaultValues().isEmpty()) {
|
||||
Schema schema = (Schema) param.getDefaultValues().get(0).getDefaultValue();
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable = MetadataToolAvroHelper
|
||||
.convertFromAvro(schema);
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable =
|
||||
MetadataToolAvroHelper.convertFromAvro(schema);
|
||||
IMetadataTable defaultTable = MetadataToolHelper.convert(defaultEmfTable);
|
||||
for (IMetadataColumn currentColumn : metadataTable.getListColumns()) {
|
||||
IMetadataColumn defaultColumn = defaultTable.getColumn(currentColumn.getLabel());
|
||||
@@ -1130,8 +1148,8 @@ public final class MetadataToolHelper {
|
||||
Object schemaObj = properties.getValuedProperty(param.getName()).getValue();
|
||||
if (schemaObj instanceof Schema) {
|
||||
Schema schema = (Schema) schemaObj;
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable emfTable = MetadataToolAvroHelper
|
||||
.convertFromAvro(schema);
|
||||
org.talend.core.model.metadata.builder.connection.MetadataTable emfTable =
|
||||
MetadataToolAvroHelper.convertFromAvro(schema);
|
||||
IMetadataTable newTable = MetadataToolHelper.convert(emfTable);
|
||||
initilializeSchema(metadataTable, newTable, mappingParameter, node);
|
||||
}
|
||||
@@ -1291,8 +1309,8 @@ public final class MetadataToolHelper {
|
||||
if (connection != null) {
|
||||
IRepositoryViewObject lastVersion = null;
|
||||
if (connection.getContextId() != null) {
|
||||
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(
|
||||
IRepositoryService.class);
|
||||
IRepositoryService service =
|
||||
GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
lastVersion = service.getProxyRepositoryFactory().getLastVersion(connection.getContextId());
|
||||
}
|
||||
if (lastVersion != null) {
|
||||
@@ -1386,7 +1404,7 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
|
||||
public static IMetadataTable convert(MetadataTable old) {
|
||||
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
ICoreService coreService = GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
IMetadataTable result = new org.talend.core.model.metadata.MetadataTable();
|
||||
result.setComment(old.getComment());
|
||||
result.setId(old.getId());
|
||||
@@ -1406,7 +1424,8 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
|
||||
for (Object o : old.getColumns()) {
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn column = (org.talend.core.model.metadata.builder.connection.MetadataColumn) o;
|
||||
org.talend.core.model.metadata.builder.connection.MetadataColumn column =
|
||||
(org.talend.core.model.metadata.builder.connection.MetadataColumn) o;
|
||||
IMetadataColumn newColumn = new org.talend.core.model.metadata.MetadataColumn();
|
||||
columns.add(newColumn);
|
||||
newColumn.setComment(column.getComment());
|
||||
@@ -1420,7 +1439,7 @@ public final class MetadataToolHelper {
|
||||
}
|
||||
newColumn.setLabel(label2);
|
||||
newColumn.setPattern(column.getPattern());
|
||||
|
||||
|
||||
if (column.getLength() < 0) {
|
||||
newColumn.setLength(null);
|
||||
} else {
|
||||
@@ -1443,12 +1462,12 @@ public final class MetadataToolHelper {
|
||||
newColumn.setCustom(Boolean.valueOf(tv.getValue()));
|
||||
} else if (DiSchemaConstants.TALEND6_IS_READ_ONLY.equals(additionalTag)) {
|
||||
newColumn.setReadOnly(Boolean.valueOf(tv.getValue()));
|
||||
}else {
|
||||
} else {
|
||||
newColumn.getAdditionalField().put(additionalTag, tv.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
newColumn.setNullable(column.isNullable());
|
||||
if (column.getPrecision() < 0) {
|
||||
newColumn.setPrecision(null);
|
||||
|
||||
@@ -308,8 +308,19 @@ public abstract class AbstractNode implements INode {
|
||||
return mapMerge.keySet().iterator().next().getSubProcessStartNode(withConditions);
|
||||
}
|
||||
}
|
||||
if ((getCurrentActiveLinksNbInput(EConnectionType.MAIN) == 0)
|
||||
&& !checkIfCurrentActiveLinksIsLookup()) {
|
||||
if (getCurrentActiveLinksNbInput(EConnectionType.MAIN) == 0) {
|
||||
IConnection aheadConnection = null;
|
||||
for (IConnection inConnection : getIncomingConnections()) {
|
||||
// refer to DataProcess.checkFlowRefLink() added RUN_AFTER for incoming connection
|
||||
if (inConnection.isActivate()
|
||||
&& inConnection.getLineStyle().getId() == EConnectionType.RUN_AFTER.getId()) {
|
||||
aheadConnection = inConnection;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aheadConnection != null) {
|
||||
return aheadConnection.getSource().getDesignSubjobStartNode();
|
||||
}
|
||||
return this; // main branch here, so we got the correct sub
|
||||
// process start.
|
||||
}
|
||||
@@ -348,27 +359,6 @@ public abstract class AbstractNode implements INode {
|
||||
return nb;
|
||||
}
|
||||
|
||||
private boolean checkIfCurrentActiveLinksIsLookup() {
|
||||
boolean flag = false;
|
||||
int input = 0;
|
||||
for (IConnection inConnection : getIncomingConnections()) {
|
||||
// refer to DataProcess.checkFlowRefLink() added RUN_AFTER for incoming connection
|
||||
if (inConnection.isActivate() && inConnection.getLineStyle().getId() == EConnectionType.RUN_AFTER.getId()) {
|
||||
input++;
|
||||
}
|
||||
}
|
||||
// check if run_after is for lookup
|
||||
if (input > 0) {
|
||||
for (IConnection outConnection : getOutgoingConnections()) {
|
||||
if (outConnection.isActivate() && outConnection.getLineStyle().getId() == EConnectionType.FLOW_REF.getId()) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -115,6 +115,8 @@ public enum EParameterFieldType {
|
||||
PATTERN_PROPERTY, // yyin, added TDQ-13437
|
||||
|
||||
UNIFIED_COMPONENTS,
|
||||
|
||||
LANGUAGE_CLOSED_LIST,
|
||||
|
||||
TACOKIT_INPUT_SCHEMA,
|
||||
TACOKIT_GUESS_SCHEMA,
|
||||
|
||||
@@ -62,6 +62,8 @@ public interface TalendProcessArgumentConstant {
|
||||
|
||||
static final String ARG_LAUNCHER_NAME = "LAUNCHER_NAME";
|
||||
|
||||
static final String ARG_AVOID_BRANCH_NAME = "AVOID_BRANCH_NAME";
|
||||
|
||||
static final String CMD_ARG_STATS_PORT_PARAM = "stat_port";
|
||||
|
||||
static final String CMD_ARG_TRACE_PORT_PARAM = "trace_port";
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryEditorInput;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
@@ -131,5 +132,7 @@ public interface ITestContainerProviderService extends IService {
|
||||
Set<ModuleNeeded> getAllJobTestcaseModules(ProcessItem item) throws PersistenceException;
|
||||
|
||||
public void deleteDataFiles(Object deleteObj);
|
||||
|
||||
public List<NodeType> getOriginalNodes(ProcessType process);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.debug.core,
|
||||
org.talend.core.repository,
|
||||
org.talend.libraries.apache,
|
||||
org.talend.core.runtime,
|
||||
org.talend.utils
|
||||
org.talend.utils,
|
||||
org.talend.libraries.dom4j-jaxen
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Export-Package: org.talend.core,
|
||||
org.talend.core.branding,
|
||||
@@ -53,6 +54,4 @@ Export-Package: org.talend.core,
|
||||
org.talend.core.services.resource,
|
||||
org.talend.core.views,
|
||||
org.talend.designer.runprocess
|
||||
Import-Package: org.apache.commons.collections4.map,
|
||||
org.dom4j,
|
||||
org.dom4j.io
|
||||
Import-Package: org.apache.commons.collections4.map
|
||||
|
||||
@@ -2202,6 +2202,47 @@ public class ProcessorUtilities {
|
||||
}
|
||||
// trunjob component
|
||||
EList<NodeType> nodes = ptype.getNode();
|
||||
getSubjobInfo(nodes, ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
|
||||
if (parentJobInfo.isTestContainer()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
getSubjobInfo(testContainerService.getOriginalNodes(ptype), ptype, parentJobInfo, jobInfos,firstChildOnly);
|
||||
}
|
||||
}
|
||||
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
for (ProcessItem testItem : testsItems) {
|
||||
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
|
||||
if (testItem.getProcess() == null) {
|
||||
testItem.setProcess(testProcess);
|
||||
}
|
||||
if (testProcess == null) {
|
||||
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
|
||||
jobInfo.setTestContainer(true);
|
||||
jobInfos.add(jobInfo);
|
||||
jobInfo.setFatherJobInfo(parentJobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
private static Set<JobInfo> getSubjobInfo(List<NodeType> nodes, ProcessType ptype, JobInfo parentJobInfo, Set<JobInfo> jobInfos,
|
||||
boolean firstChildOnly) {
|
||||
String jobletPaletteType = null;
|
||||
String frameWork = ptype.getFramework();
|
||||
if (StringUtils.isBlank(frameWork)) {
|
||||
@@ -2211,7 +2252,7 @@ public class ProcessorUtilities {
|
||||
} else if (frameWork.equals(HadoopConstants.FRAMEWORK_SPARK_STREAMING)) {
|
||||
jobletPaletteType = ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName();
|
||||
}
|
||||
for (NodeType node : nodes) {
|
||||
for (NodeType node : nodes) {
|
||||
boolean activate = true;
|
||||
// check if node is active at least.
|
||||
for (Object o : node.getElementParameter()) {
|
||||
@@ -2309,31 +2350,7 @@ public class ProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!parentJobInfo.isTestContainer() && !parentJobInfo.isJoblet()
|
||||
&& GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService =
|
||||
(ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
List<ProcessItem> testsItems =
|
||||
testContainerService.getTestContainersByVersion(parentJobInfo.getProcessItem());
|
||||
for (ProcessItem testItem : testsItems) {
|
||||
ProcessType testProcess = testContainerService.getTestContainerProcess(testItem);
|
||||
if (testItem.getProcess() == null) {
|
||||
testItem.setProcess(testProcess);
|
||||
}
|
||||
if (testProcess == null) {
|
||||
log.warn(Messages.getString("ProcessorUtilities.nullProcess")); //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
JobInfo jobInfo = new JobInfo(testItem, testProcess.getDefaultContext());
|
||||
jobInfo.setTestContainer(true);
|
||||
jobInfos.add(jobInfo);
|
||||
jobInfo.setFatherJobInfo(parentJobInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobInfos;
|
||||
return jobInfos;
|
||||
}
|
||||
|
||||
private static boolean isRouteletNode(NodeType node) {
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<groupId>org.apache.karaf.tooling</groupId>
|
||||
<artifactId>features-maven-plugin</artifactId>
|
||||
<version>2.2.9</version>
|
||||
<classifier>TESB</classifier>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -36,6 +35,13 @@
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Required by commons-lang-2.6.pom -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>17</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<artifactId>studio-components-dependencies</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<components.version>0.26.0-SNAPSHOT</components.version>
|
||||
<components.version>0.27.0-SNAPSHOT</components.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
@@ -59,15 +59,15 @@
|
||||
<version>17</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
include all: compile, runtime and provided dependencies -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>annotation</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- It fixes provided dependency scope to compile, because maven-dependency-plugin is setup to include
|
||||
only compile and runtime scopes, but provided is also required. It's not possible to setup plugin to
|
||||
include all: compile, runtime and provided dependencies -->
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
<artifactId>annotation</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.components</groupId>
|
||||
<artifactId>components-bom</artifactId>
|
||||
@@ -159,8 +159,8 @@
|
||||
<artifactId>components-api</artifactId>
|
||||
<version>${components.version}</version>
|
||||
</dependency>
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<!-- Dependencies in provided scope should be explicitly added as dependency in this module,
|
||||
because provided scope is not transitive -->
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
|
||||
@@ -25,7 +25,10 @@ import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.cli.MavenCli;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.cli.configuration.SettingsXmlConfigurationProcessor;
|
||||
import org.apache.maven.settings.Profile;
|
||||
import org.apache.maven.settings.Proxy;
|
||||
@@ -53,6 +56,8 @@ import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.ui.DesignerMavenUiPlugin;
|
||||
import org.talend.login.AbstractLoginTask;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* DOC ggu class global comment. Detailled comment
|
||||
@@ -286,10 +291,34 @@ public class M2eUserSettingForTalendLoginTask extends AbstractLoginTask {
|
||||
return false;
|
||||
}
|
||||
final String m2Repo = ".m2/repository"; //$NON-NLS-1$
|
||||
// default one
|
||||
IPath localRepoPath = new Path(System.getProperty("user.home")).append(m2Repo); //$NON-NLS-1$
|
||||
boolean isLocal = isLocalRepository();
|
||||
IPath localRepoPath = null;
|
||||
if (!isLocal) {
|
||||
String mvnHome = System.getenv("M2_HOME"); //$NON-NLS-1$
|
||||
if (mvnHome == null) {
|
||||
mvnHome = System.getenv("MAVEN_HOME"); //$NON-NLS-1$
|
||||
}
|
||||
if (StringUtils.isNotBlank(mvnHome)) {
|
||||
File globalSettings = new File(mvnHome).toPath().resolve("conf").resolve("settings.xml").toFile(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (globalSettings.exists()) {
|
||||
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
Document document = builder.parse(globalSettings);
|
||||
Node node = document.getElementsByTagName("localRepository").item(0); //$NON-NLS-1$
|
||||
if (node != null) {
|
||||
String repoPath = node.getTextContent();
|
||||
if (StringUtils.isNotBlank(repoPath)) {
|
||||
localRepoPath = new Path(repoPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localRepoPath == null) {
|
||||
// set default
|
||||
localRepoPath = new Path(System.getProperty("user.home")).append(m2Repo); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
// if local, always use config one
|
||||
if (isLocalRepository() || !enableAccessM2Repository(monitor, localRepoPath.toString())) {
|
||||
if (isLocal || !enableAccessM2Repository(monitor, localRepoPath.toString())) {
|
||||
// need change the repo setting
|
||||
localRepoPath = configPath.append(m2Repo);
|
||||
File studioDefaultRepoFolder = localRepoPath.toFile();
|
||||
@@ -394,7 +423,7 @@ public class M2eUserSettingForTalendLoginTask extends AbstractLoginTask {
|
||||
|
||||
String nonProxyHosts = p.getNonProxyHosts();
|
||||
if (nonProxyHosts != null && nonProxyHosts.trim().length() > 0) {
|
||||
List<String> bypassHosts = new ArrayList<String>();
|
||||
List<String> bypassHosts = new ArrayList<>();
|
||||
String[] nonProxiedHosts = proxyService.getNonProxiedHosts();
|
||||
if (nonProxiedHosts != null) {
|
||||
bypassHosts.addAll(Arrays.asList(nonProxiedHosts));
|
||||
|
||||
@@ -43,6 +43,8 @@ public class MavenSystemFolders {
|
||||
|
||||
public static final ProjectSystemFolder TEMP = new ProjectSystemFolder("temp");
|
||||
|
||||
public static final ProjectSystemFolder SRC = new ProjectSystemFolder("src");
|
||||
|
||||
public static final ProjectSystemFolder[] SIMPLE_DIRS = { JAVA, RESOURCES };
|
||||
|
||||
public static final ProjectSystemFolder[] TEST_DIRS = { JAVA_TEST, RESOURCES_TEST };
|
||||
|
||||
@@ -601,7 +601,10 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
mainProjectBranch = "";
|
||||
}
|
||||
}
|
||||
jobInfoContent = StringUtils.replace(jobInfoContent, "${talend.project.branch}", mainProjectBranch);
|
||||
|
||||
if (!isOptionChecked(TalendProcessArgumentConstant.ARG_AVOID_BRANCH_NAME)) {
|
||||
jobInfoContent = StringUtils.replace(jobInfoContent, "${talend.project.branch}", mainProjectBranch);
|
||||
}
|
||||
|
||||
IFolder templateFolder = codeProject.getTemplatesFolder();
|
||||
IFile shFile = templateFolder.getFile(IProjectSettingTemplateConstants.JOB_RUN_SH_TEMPLATE_FILE_NAME);
|
||||
|
||||
@@ -12,19 +12,7 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.maven.tools.extension;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
|
||||
public interface IProjectPomExtension {
|
||||
|
||||
@@ -32,33 +20,4 @@ public interface IProjectPomExtension {
|
||||
|
||||
void updatePomTemplate(Model model) throws Exception;
|
||||
|
||||
public default String getPluginVersion(String key) {
|
||||
String version = null;
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
Properties properties = new Properties();
|
||||
File file = new Path(Platform.getConfigurationLocation().getURL().getPath()).append("mojo_version.properties").toFile(); //$NON-NLS-1$
|
||||
if (file.exists()) {
|
||||
try (InputStream inStream = new FileInputStream(file)) {
|
||||
properties.load(inStream);
|
||||
version = properties.getProperty(key);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
if (version != null && !version.startsWith(talendVersion)) {
|
||||
ExceptionHandler.process(
|
||||
new Exception("Incompatible Mojo version:" + key + "[" + version + "], use default version.")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
version = null;
|
||||
}
|
||||
}
|
||||
// default version
|
||||
if (StringUtils.isBlank(version)) {
|
||||
version = talendVersion;
|
||||
String productVersion = VersionUtils.getInternalVersion();
|
||||
if (productVersion.endsWith("-SNAPSHOT") || CommonsPlugin.isJUnitTest() || Platform.inDevelopmentMode()) { //$NON-NLS-1$
|
||||
version += "-SNAPSHOT"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="resources/java"/>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
javax.xml.bind,
|
||||
org.talend.model
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-ClassPath: .
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar
|
||||
Export-Package: org.talend.librariesmanager.emf.librariesindex,
|
||||
org.talend.librariesmanager.librarydata,
|
||||
org.talend.librariesmanager.maven,
|
||||
|
||||
@@ -8,4 +8,5 @@ bin.includes = META-INF/,\
|
||||
plugin.properties,\
|
||||
model/,\
|
||||
templates/,\
|
||||
distribution/license.json
|
||||
distribution/license.json,\
|
||||
lib/crypto-utils.jar
|
||||
|
||||
BIN
main/plugins/org.talend.librariesmanager/lib/crypto-utils.jar
Normal file
BIN
main/plugins/org.talend.librariesmanager/lib/crypto-utils.jar
Normal file
Binary file not shown.
@@ -41,6 +41,27 @@
|
||||
bundleId="">
|
||||
</bundleId>
|
||||
</library>
|
||||
</systemRoutine>
|
||||
<systemRoutine
|
||||
name="PasswordEncryptUtil">
|
||||
<library
|
||||
name="crypto-utils.jar">
|
||||
<bundleId
|
||||
bundleId="">
|
||||
</bundleId>
|
||||
</library>
|
||||
<library
|
||||
name="slf4j-api-1.7.10.jar">
|
||||
<bundleId
|
||||
bundleId="org.talend.libraries.slf4j">
|
||||
</bundleId>
|
||||
</library>
|
||||
<library
|
||||
name="slf4j-log4j12-1.7.10.jar">
|
||||
<bundleId
|
||||
bundleId="org.talend.libraries.slf4j">
|
||||
</bundleId>
|
||||
</library>
|
||||
</systemRoutine>
|
||||
</extension>
|
||||
<extension
|
||||
|
||||
@@ -9,4 +9,34 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.librariesmanager</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -12,12 +12,9 @@
|
||||
// ============================================================================
|
||||
package routines.system;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
import org.talend.daikon.crypto.CipherSources;
|
||||
import org.talend.daikon.crypto.Encryption;
|
||||
import org.talend.daikon.crypto.KeySources;
|
||||
|
||||
/**
|
||||
* DOC chuang class global comment. Detailled comment
|
||||
@@ -26,36 +23,15 @@ public class PasswordEncryptUtil {
|
||||
|
||||
public static String ENCRYPT_KEY = "Encrypt"; //$NON-NLS-1$
|
||||
|
||||
private static String rawKey = "Talend-Key"; //$NON-NLS-1$
|
||||
private static final String ENCRYPTION_KEY = "Talend_TalendKey";
|
||||
|
||||
private static SecretKey key = null;
|
||||
|
||||
private static SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
private static String CHARSET = "UTF-8";
|
||||
|
||||
private static SecretKey getSecretKey() throws Exception {
|
||||
if (key == null) {
|
||||
|
||||
byte rawKeyData[] = rawKey.getBytes(CHARSET);
|
||||
DESKeySpec dks = new DESKeySpec(rawKeyData);
|
||||
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); //$NON-NLS-1$
|
||||
key = keyFactory.generateSecret(dks);
|
||||
}
|
||||
return key;
|
||||
}
|
||||
private static Encryption defaultEncryption;
|
||||
|
||||
public static String encryptPassword(String input) throws Exception {
|
||||
if (input == null) {
|
||||
return input;
|
||||
}
|
||||
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.ENCRYPT_MODE, key, secureRandom);
|
||||
byte[] cipherByte = c.doFinal(input.getBytes(CHARSET));
|
||||
String dec = Hex.encodeHexString(cipherByte);
|
||||
return dec;
|
||||
return getEncryption().encrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input) {
|
||||
@@ -63,18 +39,20 @@ public class PasswordEncryptUtil {
|
||||
return input;
|
||||
}
|
||||
try {
|
||||
byte[] dec = Hex.decodeHex(input.toCharArray());
|
||||
SecretKey key = getSecretKey();
|
||||
Cipher c = Cipher.getInstance("DES"); //$NON-NLS-1$
|
||||
c.init(Cipher.DECRYPT_MODE, key, secureRandom);
|
||||
byte[] clearByte = c.doFinal(dec);
|
||||
return new String(clearByte, CHARSET);
|
||||
return getEncryption().decrypt(input);
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
// do nothing
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
private static Encryption getEncryption() {
|
||||
if (defaultEncryption == null) {
|
||||
defaultEncryption = new Encryption(KeySources.fixedKey(ENCRYPTION_KEY), CipherSources.aes());
|
||||
}
|
||||
return defaultEncryption;
|
||||
}
|
||||
|
||||
public static final String PASSWORD_FOR_LOGS_VALUE = "...";
|
||||
|
||||
}
|
||||
|
||||
@@ -344,7 +344,11 @@ public final class XsdMetadataUtils {
|
||||
xmlNode.setRelatedColumn(uniqueName);
|
||||
metadataTable.getColumns().add(column);
|
||||
} else {
|
||||
xmlNode.setAttribute("main"); //$NON-NLS-1$
|
||||
if(loopElementFound) {
|
||||
xmlNode.setAttribute("branch");//$NON-NLS-1$
|
||||
}else {
|
||||
xmlNode.setAttribute("main"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ATreeNode.NAMESPACE_TYPE:
|
||||
@@ -357,13 +361,14 @@ public final class XsdMetadataUtils {
|
||||
case ATreeNode.OTHER_TYPE:
|
||||
break;
|
||||
}
|
||||
|
||||
boolean subElementsInLoop = inLoop;
|
||||
// will try to get the first element (branch or main), and set it as loop.
|
||||
if ((!loopElementFound && path.split("/").length == 2 && node.getType() == ATreeNode.ELEMENT_TYPE) || subElementsInLoop) { //$NON-NLS-1$
|
||||
connection.getLoop().add(xmlNode);
|
||||
loopElementFound = true;
|
||||
subElementsInLoop = true;
|
||||
} else {
|
||||
}else {
|
||||
connection.getRoot().add(xmlNode);
|
||||
}
|
||||
if (node.getChildren().length > 0) {
|
||||
|
||||
@@ -144,6 +144,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
}
|
||||
}
|
||||
java.sql.Connection sqlConnection = null;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
// MetadataConnectionUtils.setMetadataCon(metadataBean);
|
||||
// fill some base parameter
|
||||
@@ -167,13 +169,22 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
: dbMetadata.getDatabaseProductName();
|
||||
String productVersion = dbMetadata.getDatabaseProductVersion() == null ? PluginConstant.EMPTY_STRING
|
||||
: dbMetadata.getDatabaseProductVersion();
|
||||
String databaseType = dbconn.getDatabaseType();
|
||||
// TDQ-16331 Azure Mysql must use 'select version()' to get correct version
|
||||
if (EDatabaseTypeName.MYSQL.getDisplayName().equals(databaseType)) {
|
||||
stmt = sqlConnection.createStatement();
|
||||
rs = stmt.executeQuery("select version()"); //$NON-NLS-1$
|
||||
while (rs.next()) {
|
||||
productVersion = rs.getString(1);
|
||||
}
|
||||
}
|
||||
// TDI-35419 TDQ-11853: make sure the redshift connection save the productName is redshift, not use the
|
||||
// postgresql.becauses we use this value to create dbmslauguage
|
||||
boolean isRedshift = dbconn.getDatabaseType().equals(EDatabaseTypeName.REDSHIFT.getDisplayName());
|
||||
boolean isRedshift = EDatabaseTypeName.REDSHIFT.getDisplayName().equals(databaseType);
|
||||
if (isRedshift) {
|
||||
productName = EDatabaseTypeName.REDSHIFT.getDisplayName();
|
||||
}
|
||||
boolean isRedshift_SSO = dbconn.getDatabaseType().equals(EDatabaseTypeName.REDSHIFT_SSO.getDisplayName());
|
||||
boolean isRedshift_SSO = EDatabaseTypeName.REDSHIFT_SSO.getDisplayName().equals(databaseType);
|
||||
if (isRedshift_SSO) {
|
||||
productName = EDatabaseTypeName.REDSHIFT_SSO.getDisplayName();
|
||||
}
|
||||
@@ -181,14 +192,12 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
TaggedValueHelper.setTaggedValue(dbconn, TaggedValueHelper.DB_PRODUCT_NAME, productName);
|
||||
TaggedValueHelper.setTaggedValue(dbconn, TaggedValueHelper.DB_PRODUCT_VERSION, productVersion);
|
||||
|
||||
boolean isHive = dbconn.getDatabaseType().equals(EDatabaseTypeName.HIVE.getDisplayName());
|
||||
boolean isHiveJdbc = dbconn.getDatabaseType().equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())
|
||||
&& dbconn.getDriverClass() != null
|
||||
&& dbconn.getDriverClass().equals(EDatabase4DriverClassName.HIVE.getDriverClass());
|
||||
boolean isImpala = dbconn.getDatabaseType().equals(EDatabaseTypeName.IMPALA.getDisplayName());
|
||||
boolean isImpalaJdbc = dbconn.getDatabaseType().equals(EDatabaseTypeName.IMPALA.getDisplayName())
|
||||
&& dbconn.getDriverClass() != null
|
||||
&& dbconn.getDriverClass().equals(EDatabase4DriverClassName.IMPALA.getDriverClass());
|
||||
boolean isHive = EDatabaseTypeName.HIVE.getDisplayName().equals(databaseType);
|
||||
boolean isHiveJdbc = EDatabaseTypeName.GENERAL_JDBC.getDisplayName().equals(databaseType)
|
||||
&& EDatabase4DriverClassName.HIVE.getDriverClass().equals(dbconn.getDriverClass());
|
||||
boolean isImpala = EDatabaseTypeName.IMPALA.getDisplayName().equals(databaseType);
|
||||
boolean isImpalaJdbc = EDatabaseTypeName.IMPALA.getDisplayName().equals(databaseType)
|
||||
&& EDatabase4DriverClassName.IMPALA.getDriverClass().equals(dbconn.getDriverClass());
|
||||
if (!isHive && !isHiveJdbc && !isImpala && !isImpalaJdbc) {
|
||||
String identifierQuote = dbMetadata.getIdentifierQuoteString();
|
||||
ConnectionHelper.setIdentifierQuoteString(identifierQuote == null ? "" : identifierQuote, dbconn); //$NON-NLS-1$
|
||||
@@ -206,13 +215,19 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
|
||||
if (sqlConnection != null) {
|
||||
ConnectionUtils.closeConnection(sqlConnection);
|
||||
}
|
||||
if (driver != null
|
||||
&& MetadataConnectionUtils.isDerbyRelatedDb(metadataBean.getDriverClass(), metadataBean.getDbType())) {
|
||||
try {
|
||||
try {
|
||||
if (driver != null && MetadataConnectionUtils
|
||||
.isDerbyRelatedDb(metadataBean.getDriverClass(), metadataBean.getDbType())) {
|
||||
driver.connect("jdbc:derby:;shutdown=true", null); //$NON-NLS-1$
|
||||
} catch (SQLException e) {
|
||||
// exception of shutdown success. no need to catch.
|
||||
}
|
||||
if (stmt != null) {
|
||||
stmt.close();
|
||||
}
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
// exception of shutdown success. no need to catch.
|
||||
}
|
||||
}
|
||||
if (newConnection != null) {
|
||||
|
||||
@@ -1088,6 +1088,11 @@ public class ConnectionHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* TUP-21510, should only work for old migration task.
|
||||
*/
|
||||
@Deprecated
|
||||
public static String getCleanPassword(String password) {
|
||||
if (StringUtils.isBlank(password)) {
|
||||
return password;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?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"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="lib" path="lib/crypto-utils.jar"/>
|
||||
<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"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
@@ -28,13 +28,15 @@ Export-Package:
|
||||
org.talend.utils.time;uses:="org.apache.log4j",
|
||||
org.talend.utils.wsdl,
|
||||
org.talend.utils.xml
|
||||
Bundle-ClassPath: .
|
||||
Bundle-ClassPath: .,
|
||||
lib/crypto-utils.jar
|
||||
Require-Bundle: org.apache.commons.lang,
|
||||
org.talend.libraries.apache;visibility:=reexport,
|
||||
org.apache.log4j,
|
||||
org.apache.commons.io,
|
||||
org.talend.daikon;visibility:=reexport,
|
||||
org.bouncycastle.bcprov,
|
||||
org.apache.httpcomponents.httpclient
|
||||
org.apache.httpcomponents.httpclient,
|
||||
org.slf4j.api
|
||||
Eclipse-BuddyPolicy: registered
|
||||
Eclipse-RegisterBuddy: org.apache.log4j, org.talend.testutils
|
||||
|
||||
@@ -4,6 +4,7 @@ source.dist/org.talend.utils.jar = src/main/java/
|
||||
output.dist/org.talend.utils.jar = class/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
dist/
|
||||
dist/,\
|
||||
lib/crypto-utils.jar
|
||||
jars.compile.order = .,\
|
||||
dist/org.talend.utils.jar
|
||||
|
||||
BIN
main/plugins/org.talend.utils/lib/crypto-utils.jar
Normal file
BIN
main/plugins/org.talend.utils/lib/crypto-utils.jar
Normal file
Binary file not shown.
@@ -1,64 +1,91 @@
|
||||
<?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>tcommon-studio-se</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.utils</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<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>tcommon-studio-se</artifactId>
|
||||
<version>7.2.1-SNAPSHOT</version>
|
||||
<relativePath>../../../</relativePath>
|
||||
</parent>
|
||||
<artifactId>org.talend.utils</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>daikon</artifactId>
|
||||
<version>0.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-deploy</id>
|
||||
<phase>deploy</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.51</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>daikon</artifactId>
|
||||
<version>0.2.0.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,6 +16,10 @@
|
||||
<relativePath>../pom_server.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -58,6 +62,16 @@
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -87,6 +101,32 @@
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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">
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
<!--
|
||||
Copyright (C) 2010 Talend Inc. - www.talend.com
|
||||
-->
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -16,6 +16,10 @@
|
||||
<relativePath>../pom_server.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
@@ -63,6 +67,16 @@
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.10</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -87,6 +101,32 @@
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- same as org.talend.libraries.excel -->
|
||||
<id>copy-maven-repository</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.basedir}/lib</outputDirectory>
|
||||
<destFileName>crypto-utils.jar</destFileName>
|
||||
<artifactItems>
|
||||
<dependency>
|
||||
<groupId>org.talend.daikon</groupId>
|
||||
<artifactId>crypto-utils</artifactId>
|
||||
<version>${org.talend.daikon.crypto-utils.version}</version>
|
||||
</dependency>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.talend.utils.security;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 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
|
||||
//
|
||||
// ============================================================================
|
||||
import org.talend.daikon.crypto.CipherSources;
|
||||
import org.talend.daikon.crypto.Encryption;
|
||||
import org.talend.daikon.crypto.KeySources;
|
||||
|
||||
public class AESEncryption {
|
||||
|
||||
//TODO We should remove default key after implements master key encryption algorithm
|
||||
private static final String ENCRYPTION_KEY = "Talend_TalendKey";// The length of key should be 16, 24 or 32.
|
||||
|
||||
private static Encryption defaultEncryption;
|
||||
|
||||
public static String encryptPassword(String input, String key) throws Exception {
|
||||
Encryption encryption = getEncryption(key);
|
||||
return encryption.encrypt(input);
|
||||
}
|
||||
|
||||
public static String encryptPassword(String input) throws Exception {
|
||||
Encryption encryption = getEncryption();
|
||||
return encryption.encrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input, String key) throws Exception {
|
||||
Encryption encryption = getEncryption(key);
|
||||
return encryption.decrypt(input);
|
||||
}
|
||||
|
||||
public static String decryptPassword(String input) throws Exception {
|
||||
Encryption encryption = getEncryption();
|
||||
return encryption.decrypt(input);
|
||||
}
|
||||
|
||||
private static Encryption getEncryption() {
|
||||
if (defaultEncryption == null) {
|
||||
defaultEncryption = getEncryption(ENCRYPTION_KEY);
|
||||
}
|
||||
return defaultEncryption;
|
||||
}
|
||||
|
||||
private static Encryption getEncryption(String key) {
|
||||
return new Encryption(KeySources.fixedKey(key), CipherSources.aes());
|
||||
}
|
||||
}
|
||||
3
pom.xml
3
pom.xml
@@ -9,6 +9,9 @@
|
||||
</parent>
|
||||
<artifactId>tcommon-studio-se</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<properties>
|
||||
<org.talend.daikon.crypto-utils.version>1.2.0</org.talend.daikon.crypto-utils.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>talend_open</id>
|
||||
|
||||
@@ -12,16 +12,38 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.URIUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.talend.utils.ProductVersion;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class VersionUtilsTest {
|
||||
|
||||
private File mojo_properties;
|
||||
|
||||
private File eclipseproductFile;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mojo_properties = new Path(Platform.getConfigurationLocation().getURL().getPath()).append("mojo_version.properties") //$NON-NLS-1$
|
||||
.toFile();
|
||||
backupEcilpseproductFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.VersionUtils#getTalendVersion()}.
|
||||
*/
|
||||
@@ -31,4 +53,77 @@ public class VersionUtilsTest {
|
||||
ProductVersion studioVersion = ProductVersion.fromString(VersionUtils.getDisplayVersion());
|
||||
assertEquals(studioVersion, talendVersion);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginVersion__Eclipseproduct() throws Exception {
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-SNAPSHOT");
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-M5");
|
||||
assertEquals(talendVersion + "-M5", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200");
|
||||
assertEquals(talendVersion, VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
// for other revision, use release version as default.
|
||||
setPropertiesValue(eclipseproductFile, "version", talendVersion + ".20190500_1200-RC1");
|
||||
assertEquals(talendVersion, VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPluginVersion__MojoProperties() throws Exception {
|
||||
String talendVersion = VersionUtils.getTalendVersion();
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
if (mojo_properties.exists()) {
|
||||
mojo_properties.delete();
|
||||
}
|
||||
mojo_properties.createNewFile();
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", talendVersion + "-patch1");
|
||||
assertEquals(talendVersion + "-patch1", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
|
||||
setPropertiesValue(mojo_properties, "ci.builder.version", "6.0.0");
|
||||
assertEquals(talendVersion + "-SNAPSHOT", VersionUtils.getMojoVersion("ci.builder.version"));
|
||||
}
|
||||
|
||||
private void setPropertiesValue(File propertiesFile, String key, String value) throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(key, value);
|
||||
try (OutputStream out = new FileOutputStream(propertiesFile)) {
|
||||
properties.store(out, "From junit");
|
||||
}
|
||||
}
|
||||
|
||||
private void backupEcilpseproductFile() throws Exception {
|
||||
File installFolder = URIUtil.toFile(URIUtil.toURI(Platform.getInstallLocation().getURL()));
|
||||
eclipseproductFile = new File(installFolder, ".eclipseproduct");//$NON-NLS-1$
|
||||
File targetFile = new File(installFolder, "bak.eclipseproduct");//$NON-NLS-1$
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
FilesUtils.copyFile(eclipseproductFile, targetFile);
|
||||
}
|
||||
|
||||
private void restoreEclipseproductFile() throws Exception {
|
||||
File installFolder = URIUtil.toFile(URIUtil.toURI(Platform.getInstallLocation().getURL()));
|
||||
File backupFile = new File(installFolder, "bak.eclipseproduct");//$NON-NLS-1$
|
||||
File targetFile = eclipseproductFile;
|
||||
try {
|
||||
if (targetFile.exists()) {
|
||||
targetFile.delete();
|
||||
}
|
||||
FilesUtils.copyFile(backupFile, targetFile);
|
||||
} finally {
|
||||
backupFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (mojo_properties != null && mojo_properties.exists()) {
|
||||
mojo_properties.delete();
|
||||
}
|
||||
restoreEclipseproductFile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,11 +25,11 @@ import javax.xml.soap.Node;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -37,13 +37,11 @@ import org.w3c.dom.NodeList;
|
||||
/**
|
||||
* DOC xqliu class global comment. Detailled comment
|
||||
*/
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({ FilesUtils.class })
|
||||
@PowerMockIgnore({"org.w3c.*", "javax.xml.*", "com.sun.*"})
|
||||
public class FilesUtilsTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.io.FilesUtils#getUUID(java.lang.String)}
|
||||
*/
|
||||
|
||||
@@ -78,16 +78,16 @@ public class ElementParameterParserTest {
|
||||
|
||||
// "ab"
|
||||
when(parameter.getValue()).thenReturn("\"ab\"");
|
||||
assertEquals("\"b2ffaf80bd12fbe9\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"mhTO5ftbNXqfUMNXo3nHmg==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\"b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\"b\"");
|
||||
assertEquals("\"81f12ffeb5daed01\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"5mxyOpkHaSqOq8z2V2INkQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\\b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\\b\"");
|
||||
assertEquals("\"a745923703c42ed8\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"7GBfp1sX6vnzVV/sa7za6A==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "a\\\\b"
|
||||
when(parameter.getValue()).thenReturn("\"a\\\\\\\\b\"");
|
||||
assertEquals("\"d0e9b75c43bbc953\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"3x1Wn/yy2UiJwaPAMCJUOQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// "test"+context.mypassword + "a"
|
||||
when(parameter.getValue()).thenReturn("\"test\"+context.mypassword + \"a\"");
|
||||
assertEquals("\"test\"+context.mypassword + \"a\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
@@ -96,9 +96,9 @@ public class ElementParameterParserTest {
|
||||
assertEquals("\"a\" + \"b\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// \\123456/
|
||||
when(parameter.getValue()).thenReturn("\"\\\\123456/\"");
|
||||
assertEquals("\"4bd6e9847da74e5d8c3ef1db4cd6aed6\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"B7HIZB1mu4mrbvTqJk84XQ==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
// \123456/
|
||||
when(parameter.getValue()).thenReturn("\"\\123456/\"");
|
||||
assertEquals("\"71ba460575307d5af4f7aba1746784ea\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
assertEquals("\"bzSVFVjd9z6nk8jyKYi3iw==\"", ElementParameterParser.getEncryptedValue(node, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,10 @@ public class PasswordEncryptUtilTest {
|
||||
@Test
|
||||
public void testEncryptPasswordHex() throws Exception {
|
||||
Assert.assertNull(PasswordEncryptUtil.encryptPasswordHex(null));
|
||||
Assert.assertEquals("f4f7aba1746784ea", PasswordEncryptUtil.encryptPasswordHex(""));
|
||||
|
||||
Assert.assertEquals("910351e7b8926e62", PasswordEncryptUtil.encryptPasswordHex("Talend"));
|
||||
Assert.assertEquals("4d6073c4a9734e61", PasswordEncryptUtil.encryptPasswordHex("toor"));
|
||||
Assert.assertEquals("00104aa786b8cf2a6c5b4f14a2e00b07", PasswordEncryptUtil.encryptPasswordHex("Talend123"));
|
||||
Assert.assertEquals("Po/9NgcqCzP4IajGQh6BNA==", PasswordEncryptUtil.encryptPasswordHex(""));
|
||||
Assert.assertEquals("LyQOjBhSDr9RkpZzwK3aTQ==", PasswordEncryptUtil.encryptPasswordHex("Talend"));
|
||||
Assert.assertEquals("3Tns/4xk6/iPgnKGUTte2g==", PasswordEncryptUtil.encryptPasswordHex("toor"));
|
||||
Assert.assertEquals("4o7ak6AT0N1GCHazzWLyoQ==", PasswordEncryptUtil.encryptPasswordHex("Talend123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.anyObject;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -406,16 +410,11 @@ public class ProcessorUtilitiesTest {
|
||||
IComponent comp = mock(IComponent.class);
|
||||
when(dbNode.getComponent()).thenReturn(comp);
|
||||
when(comp.getComponentType()).thenReturn(EComponentType.EMF);
|
||||
|
||||
List params = new ArrayList();
|
||||
when(dbNode.getElementParameters()).thenReturn(params);
|
||||
when(comp.getName()).thenReturn("tSAPTableInput");
|
||||
|
||||
// TYPE parameter
|
||||
IElementParameter typeParam = mock(IElementParameter.class);
|
||||
params.add(typeParam);
|
||||
when(typeParam.getName()).thenReturn("TYPE");
|
||||
when(typeParam.getFieldType()).thenReturn(EParameterFieldType.TEXT);
|
||||
when(typeParam.getValue()).thenReturn("MySQL");
|
||||
when(dbNode.getElementParameterFromField(anyObject())).thenReturn(typeParam);
|
||||
|
||||
List metadataList = new ArrayList<>();
|
||||
when(dbNode.getMetadataList()).thenReturn(metadataList);
|
||||
|
||||
@@ -12,38 +12,30 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.model.metadata;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
import org.talend.metadata.managment.model.MetadataFillFactory;
|
||||
import org.talend.metadata.managment.model.SybaseConnectionFillerImpl;
|
||||
import org.talend.model.bridge.ReponsitoryContextBridge;
|
||||
import org.talend.utils.properties.PropertiesLoader;
|
||||
import org.talend.utils.properties.TypedProperties;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* DOC zshen class global comment. Detailled comment
|
||||
*/
|
||||
@PrepareForTest({ ReponsitoryContextBridge.class, MetadataTalendType.class })
|
||||
public class MetadataFillFactoryTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
private Map<String, String> initParameterMap() {
|
||||
Map<String, String> returnMap = new HashMap<String, String>();
|
||||
TypedProperties connectionParams = PropertiesLoader.getProperties(MetadataFillFactoryTest.class,
|
||||
@@ -101,7 +93,7 @@ public class MetadataFillFactoryTest {
|
||||
|| Boolean.toString(metadataConnection.isRetrieveAllMetadata()).equals(parameterMap.get("retrieveAllMetadata")));
|
||||
assertSame(metadataConnection.getUrl(), parameterMap.get("jdbcUrl"));
|
||||
assertNotNull("Product is not null", metadataConnection.getProduct());
|
||||
assertNull("Mapping is null", metadataConnection.getMapping());
|
||||
assertEquals("Mapping is mysql_id", "mysql_id", metadataConnection.getMapping());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,8 @@ package org.talend.core.model.metadata.builder.database.dburl;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
|
||||
/**
|
||||
* DOC msjian class global comment. Detailled comment
|
||||
@@ -25,9 +23,6 @@ import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
@PrepareForTest({ SupportDBUrlType.class })
|
||||
public class SupportDBUrlTypeTest {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.core.model.metadata.builder.database.dburl.SupportDBUrlType#isMssql(String)} .
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,7 @@ public class AS400ExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
@Override
|
||||
protected void verify4ExtractTablesFromDB(DatabaseMetaData mockedDBMetadata, ResultSet mockedGetTablesResultSet)
|
||||
throws SQLException {
|
||||
verify(mockedDBMetadata).getTables(anyString(), anyString(), anyString(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables((String) isNull(), anyString(), (String) isNull(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables(isNull(), anyString(), isNull(), any(String[].class));
|
||||
// special
|
||||
verify(mockedDBMetadata, times(2)).supportsSchemasInTableDefinitions();
|
||||
// because limit is 1, so will call twince
|
||||
|
||||
@@ -43,11 +43,9 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.rule.PowerMockRule;
|
||||
import org.talend.core.database.EDatabase4DriverClassName;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.IMetadataConnection;
|
||||
@@ -72,9 +70,6 @@ import orgomg.cwm.objectmodel.core.Feature;
|
||||
@Ignore
|
||||
public class AbstractTest4ExtractManager {
|
||||
|
||||
@Rule
|
||||
public PowerMockRule powerMockRule = new PowerMockRule();
|
||||
|
||||
private ExtractManager extractManger;
|
||||
|
||||
private ExtractMetaDataUtils extractMeta;
|
||||
@@ -224,7 +219,7 @@ public class AbstractTest4ExtractManager {
|
||||
when(mockedDBMetadata.getTableTypes()).thenReturn(mockedTableTypeResultSet);
|
||||
// tables
|
||||
ResultSet mockedGetTablesResultSet = mockGetTablesResultSet4ExtractTablesFromDB();
|
||||
when(mockedDBMetadata.getTables(anyString(), anyString(), anyString(), any(String[].class))).thenReturn(
|
||||
when(mockedDBMetadata.getTables(isNull(), anyString(), isNull(), any(String[].class))).thenReturn(
|
||||
mockedGetTablesResultSet);
|
||||
|
||||
// because only test one table, so limit 1 to make sure "break" the "while"
|
||||
@@ -255,9 +250,8 @@ public class AbstractTest4ExtractManager {
|
||||
// verify(mockedTableTypeResultSet).next();
|
||||
// verify(mockedTableTypeResultSet).close();
|
||||
|
||||
verify(mockedDBMetadata).getTables(anyString(), anyString(), anyString(), any(String[].class));
|
||||
// same
|
||||
verify(mockedDBMetadata).getTables((String) isNull(), anyString(), (String) isNull(), any(String[].class));
|
||||
verify(mockedDBMetadata).getTables(isNull(), anyString(), isNull(), any(String[].class));
|
||||
|
||||
verify(mockedDBMetadata).supportsSchemasInTableDefinitions();
|
||||
// because limit is 1, so will call twince
|
||||
@@ -742,11 +736,6 @@ public class AbstractTest4ExtractManager {
|
||||
protected TdTable mockTable4ReturnColumns4reCreateConnection() throws Exception {
|
||||
TdTable tdTable = mock(TdTable.class);
|
||||
when(tdTable.getName()).thenReturn("TestTable2");
|
||||
ResourceSet resourceSet = new ResourceSetImpl();
|
||||
Resource resource = resourceSet.createResource(URI.createFileURI("tdtable.xml")); //$NON-NLS-1$
|
||||
if (resource != null) {
|
||||
resource.getContents().add(tdTable);
|
||||
}
|
||||
when(tdTable.getFeature()).thenReturn(new BasicEList<Feature>());
|
||||
return tdTable;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class HSQLDBExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
when(driver.connect(anyString(), any(Properties.class))).thenReturn(any(Connection.class));
|
||||
|
||||
Assert.assertTrue(getExtractManger().closeConnectionForDerby(driverShim));
|
||||
verify(driver).connect(anyString(), any(Properties.class));
|
||||
verify(driver).connect(anyString(), isNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -87,7 +87,7 @@ public class JavaDBExtractManagerTest extends AbstractTest4ExtractManager {
|
||||
@Override
|
||||
protected void testCloseConnect_Verify(IMetadataConnection metadataConn, DriverShim wapperDriver) throws Exception {
|
||||
Assert.assertTrue(getExtractManger().closeConnection(metadataConn, wapperDriver));
|
||||
verify(wapperDriver).connect(anyString(), any(Properties.class));
|
||||
verify(wapperDriver).connect(anyString(), isNull());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/assertj-core-3.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/xpp3-1.1.4c.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javassist-3.20.0-GA.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mockito-core-1.10.19.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/objenesis-2.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-mockito-1.6.5-full.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-mockito-common-1.6.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-rule-1.6.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/classmexer-0.0.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-classloading-base-1.6.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/powermock-classloading-xstream-1.6.5.jar"/>
|
||||
<classpathentry kind="lib" path="lib/xstream-1.4.9.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/assertj-core-3.5.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-1.9.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/byte-buddy-agent-1.9.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/classmexer-0.0.3.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javassist-3.24.0-GA.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mockito-core-2.23.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/objenesis-2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-mockito2-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-api-support-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-core-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-module-junit4-common-2.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/powermock-reflect-2.0.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -4,36 +4,24 @@ Bundle-Name: Mockito
|
||||
Bundle-SymbolicName: org.talend.testutils
|
||||
Bundle-Version: 7.2.1.qualifier
|
||||
Bundle-ClassPath: .,
|
||||
lib/cglib-nodep-2.2.2.jar,
|
||||
lib/javassist-3.20.0-GA.jar,
|
||||
lib/mockito-core-1.10.19.jar,
|
||||
lib/objenesis-2.2.jar,
|
||||
lib/powermock-mockito-1.6.5-full.jar,
|
||||
lib/powermock-api-mockito-common-1.6.5.jar,
|
||||
lib/powermock-module-junit4-rule-1.6.5.jar,
|
||||
lib/assertj-core-3.5.2.jar,
|
||||
lib/byte-buddy-1.9.10.jar,
|
||||
lib/byte-buddy-agent-1.9.10.jar,
|
||||
lib/classmexer-0.0.3.1.jar,
|
||||
lib/powermock-classloading-base-1.6.5.jar,
|
||||
lib/powermock-classloading-xstream-1.6.5.jar,
|
||||
lib/xstream-1.4.9.jar,
|
||||
lib/xpp3-1.1.4c.jar,
|
||||
lib/assertj-core-3.0.0.jar
|
||||
lib/javassist-3.24.0-GA.jar,
|
||||
lib/mockito-core-2.23.4.jar,
|
||||
lib/objenesis-2.6.jar,
|
||||
lib/powermock-api-mockito2-2.0.0.jar,
|
||||
lib/powermock-api-support-2.0.0.jar,
|
||||
lib/powermock-core-2.0.0.jar,
|
||||
lib/powermock-module-junit4-2.0.0.jar,
|
||||
lib/powermock-module-junit4-common-2.0.0.jar,
|
||||
lib/powermock-reflect-2.0.0.jar
|
||||
Export-Package: com.javamex.classmexer,
|
||||
javassist,
|
||||
org.assertj.core.api,
|
||||
org.mockito,
|
||||
org.mockito.asm,
|
||||
org.mockito.asm.tree,
|
||||
org.mockito.asm.tree.analysis,
|
||||
org.mockito.asm.util,
|
||||
org.mockito.cglib.beans,
|
||||
org.mockito.cglib.core,
|
||||
org.mockito.cglib.proxy,
|
||||
org.mockito.cglib.reflect,
|
||||
org.mockito.cglib.transform,
|
||||
org.mockito.cglib.transform.impl,
|
||||
org.mockito.cglib.util,
|
||||
org.mockito.configuration,
|
||||
org.mockito.exceptions,
|
||||
org.mockito.exceptions.base,
|
||||
org.mockito.exceptions.misusing,
|
||||
org.mockito.exceptions.stacktrace,
|
||||
@@ -47,23 +35,17 @@ Export-Package: com.javamex.classmexer,
|
||||
org.mockito.plugins,
|
||||
org.mockito.runners,
|
||||
org.mockito.stubbing,
|
||||
org.mockito.stubbing.answers,
|
||||
org.mockito.verification,
|
||||
org.powermock.api.extension.listener,
|
||||
org.powermock.api.extension.proxyframework,
|
||||
org.powermock.api.extension.reporter,
|
||||
org.powermock.api.mockito,
|
||||
org.powermock.api.mockito.expectation,
|
||||
org.powermock.api.mockito.mockpolicies,
|
||||
org.powermock.api.mockito.powermocklistener,
|
||||
org.powermock.api.mockito.repackaged,
|
||||
org.powermock.api.mockito.verification,
|
||||
org.powermock.api.support,
|
||||
org.powermock.api.support.membermodification,
|
||||
org.powermock.api.support.membermodification.strategy,
|
||||
org.powermock.api.support.membermodification.strategy.impl,
|
||||
org.powermock.classloading,
|
||||
org.powermock.classloading.spi,
|
||||
org.powermock.core,
|
||||
org.powermock.core.agent,
|
||||
org.powermock.core.classloader,
|
||||
@@ -76,20 +58,13 @@ Export-Package: com.javamex.classmexer,
|
||||
org.powermock.core.spi.testresult.impl,
|
||||
org.powermock.core.testlisteners,
|
||||
org.powermock.core.transformers,
|
||||
org.powermock.core.transformers.impl,
|
||||
org.powermock.mockpolicies,
|
||||
org.powermock.mockpolicies.impl,
|
||||
org.powermock.mockpolicies.support,
|
||||
org.powermock.modules.junit3,
|
||||
org.powermock.modules.junit4,
|
||||
org.powermock.modules.junit4.legacy,
|
||||
org.powermock.modules.junit4.rule,
|
||||
org.powermock.modules.testng,
|
||||
org.powermock.reflect,
|
||||
org.powermock.reflect.exceptions,
|
||||
org.powermock.reflect.matching,
|
||||
org.powermock.reflect.proxyframework,
|
||||
org.powermock.reflect.spi,
|
||||
org.powermock.tests.utils,
|
||||
org.powermock.tests.utils.impl,
|
||||
org.powermock.utils,
|
||||
|
||||
@@ -3,16 +3,17 @@ output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
lib/,\
|
||||
lib/cglib-nodep-2.2.2.jar,\
|
||||
lib/javassist-3.20.0-GA.jar,\
|
||||
lib/mockito-core-1.10.19.jar,\
|
||||
lib/objenesis-2.2.jar,\
|
||||
lib/powermock-mockito-1.6.5-full.jar,\
|
||||
lib/powermock-api-mockito-common-1.6.5.jar,\
|
||||
lib/powermock-module-junit4-rule-1.6.5.jar,\
|
||||
plugin.xml,\
|
||||
lib/assertj-core-3.5.2.jar,\
|
||||
lib/byte-buddy-1.9.10.jar,\
|
||||
lib/byte-buddy-agent-1.9.10.jar,\
|
||||
lib/classmexer-0.0.3.1.jar,\
|
||||
lib/powermock-classloading-base-1.6.5.jar,\
|
||||
lib/powermock-classloading-xstream-1.6.5.jar,\
|
||||
lib/xstream-1.4.9.jar,\
|
||||
lib/xpp3-1.1.4c.jar,\
|
||||
lib/assertj-core-3.0.0.jar
|
||||
lib/javassist-3.24.0-GA.jar,\
|
||||
lib/mockito-core-2.23.4.jar,\
|
||||
lib/objenesis-2.6.jar,\
|
||||
lib/powermock-api-mockito2-2.0.0.jar,\
|
||||
lib/powermock-api-support-2.0.0.jar,\
|
||||
lib/powermock-core-2.0.0.jar,\
|
||||
lib/powermock-module-junit4-2.0.0.jar,\
|
||||
lib/powermock-module-junit4-common-2.0.0.jar,\
|
||||
lib/powermock-reflect-2.0.0.jar
|
||||
|
||||
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/assertj-core-3.5.2.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/assertj-core-3.5.2.jar
Normal file
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/byte-buddy-1.9.10.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/byte-buddy-1.9.10.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/javassist-3.24.0-GA.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/javassist-3.24.0-GA.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/mockito-core-2.23.4.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/mockito-core-2.23.4.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/objenesis-2.6.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/objenesis-2.6.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
test/plugins/org.talend.testutils/lib/powermock-core-2.0.0.jar
Normal file
BIN
test/plugins/org.talend.testutils/lib/powermock-core-2.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,51 @@
|
||||
package org.talend.utils.security;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 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
|
||||
//
|
||||
// ============================================================================import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
public class AESEncryptionTest {
|
||||
|
||||
private String input1 = "Talend";
|
||||
|
||||
private String input2 = "123456";
|
||||
|
||||
private String input3 = "Talend_123456";
|
||||
|
||||
@Test
|
||||
public void testDecryptPassword() throws Exception {
|
||||
assertNotEquals(input1, AESEncryption.encryptPassword(input1));
|
||||
assertEquals(input1, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input1)));
|
||||
|
||||
assertNotEquals(input2, AESEncryption.encryptPassword(input2));
|
||||
assertEquals(input2, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input2)));
|
||||
|
||||
assertNotEquals(input3, AESEncryption.encryptPassword(input3));
|
||||
assertEquals(input3, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input3)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecryptPasswordUseKey() throws Exception {
|
||||
String key = "1234567890123456";
|
||||
|
||||
assertNotEquals(input1, AESEncryption.encryptPassword(input1, key));
|
||||
assertEquals(input1, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input1, key), key));
|
||||
|
||||
assertNotEquals(input2, AESEncryption.encryptPassword(input2, key));
|
||||
assertEquals(input2, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input2, key), key));
|
||||
|
||||
assertNotEquals(input3, AESEncryption.encryptPassword(input3, key));
|
||||
assertEquals(input3, AESEncryption.decryptPassword(AESEncryption.encryptPassword(input3, key), key));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user