Compare commits
12 Commits
release/7.
...
patch_clou
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66efe6b15e | ||
|
|
77808f4c55 | ||
|
|
cec605bf4d | ||
|
|
5fdf7e91fe | ||
|
|
49e52d4af2 | ||
|
|
154c38983c | ||
|
|
138a5d620a | ||
|
|
1c257b873f | ||
|
|
8a67969b9c | ||
|
|
0832273bef | ||
|
|
58505f25f4 | ||
|
|
4285c3124a |
@@ -432,6 +432,9 @@ public interface IRepositoryFactory {
|
||||
public List<ILockBean> getAllRemoteLocks();
|
||||
|
||||
public void loadProjectAndSetContext(IProject eclipseProject) throws PersistenceException;
|
||||
|
||||
public void loadProjectAndSetContext(Project project, IProject eclipseProject, boolean updateCurrentProject)
|
||||
throws PersistenceException;
|
||||
|
||||
public byte[] getReferenceSettingContent(Project project, String branch) throws PersistenceException;
|
||||
|
||||
|
||||
@@ -1587,6 +1587,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.loadProjectAndSetContext(eclipseProject);
|
||||
}
|
||||
|
||||
public void loadProjectAndSetContext(Project project, IProject eclipseProject, boolean updateCurrentProject)
|
||||
throws PersistenceException {
|
||||
this.repositoryFactoryFromProvider.loadProjectAndSetContext(project, eclipseProject, updateCurrentProject);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC smallet Comment method "emptyTempFolder".
|
||||
*
|
||||
|
||||
@@ -44,6 +44,8 @@ public class RepositoryContext {
|
||||
|
||||
private Map<String, String> fields;
|
||||
|
||||
private boolean token = false;
|
||||
|
||||
/**
|
||||
* DOC smallet RepositoryContext constructor comment.
|
||||
*
|
||||
@@ -246,4 +248,12 @@ public class RepositoryContext {
|
||||
public void setNoUpdateWhenLogon(boolean noUpdateWhenLogon) {
|
||||
this.noUpdateWhenLogon = noUpdateWhenLogon;
|
||||
}
|
||||
|
||||
public boolean isToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public void setToken(boolean token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class ConnectionBean implements Cloneable {
|
||||
|
||||
private Map<String, String> dynamicFields = new HashMap<String, String>();
|
||||
|
||||
private static final String TOKEN = "token"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* DOC smallet ConnectionBean constructor comment.
|
||||
*/
|
||||
@@ -281,6 +283,25 @@ public class ConnectionBean implements Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isToken() {
|
||||
try {
|
||||
if (conDetails.has(TOKEN)) {
|
||||
return (Boolean) conDetails.get(TOKEN);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setToken(boolean token) {
|
||||
try {
|
||||
conDetails.put(TOKEN, token);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionBean clone() throws CloneNotSupportedException {
|
||||
return writeFromJSON(this.getConDetails());
|
||||
@@ -303,6 +324,7 @@ public class ConnectionBean implements Cloneable {
|
||||
toReturn.setPassword(st[i++]);
|
||||
toReturn.setWorkSpace(st[i++]);
|
||||
toReturn.setComplete(new Boolean(st[i++]));
|
||||
toReturn.setToken(new Boolean(st[i++]));
|
||||
JSONObject dynamicJson = new JSONObject();
|
||||
toReturn.getConDetails().put(DYNAMICFIELDS, dynamicJson);
|
||||
while (i < st.length) {
|
||||
|
||||
@@ -46,6 +46,8 @@ public class ModuleNeeded {
|
||||
|
||||
private boolean required;
|
||||
|
||||
private boolean excluded;
|
||||
|
||||
private boolean mrRequired = false; // That indicates if the module is
|
||||
// required by M/R job.
|
||||
|
||||
@@ -293,6 +295,14 @@ public class ModuleNeeded {
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return this.excluded;
|
||||
}
|
||||
|
||||
public void setExcluded(boolean excluded) {
|
||||
this.excluded = excluded;
|
||||
}
|
||||
|
||||
public ELibraryInstallStatus getStatus() {
|
||||
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerService.class);
|
||||
|
||||
@@ -1498,4 +1498,20 @@ public class ERepositoryObjectType extends DynaEnum<ERepositoryObjectType> {
|
||||
}
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
public static List<ERepositoryObjectType> getAllTypesOfCodes() {
|
||||
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
|
||||
if (ERepositoryObjectType.ROUTINES != null) {
|
||||
allTypes.add(ERepositoryObjectType.ROUTINES);
|
||||
}
|
||||
ERepositoryObjectType beansType = ERepositoryObjectType.valueOf("BEANS"); //$NON-NLS-1$
|
||||
if (beansType != null) {
|
||||
allTypes.add(beansType);
|
||||
}
|
||||
if (ERepositoryObjectType.PIG_UDF != null) {
|
||||
allTypes.add(ERepositoryObjectType.PIG_UDF);
|
||||
}
|
||||
return allTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,4 +69,6 @@ public interface TalendProcessOptionConstants {
|
||||
|
||||
public static final int MODULES_FOR_MR = 1 << 4;
|
||||
|
||||
public static final int MODULES_EXCLUDE_SHADED = 1 << 5;
|
||||
|
||||
}
|
||||
|
||||
@@ -222,6 +222,8 @@ public interface IRunProcessService extends IService {
|
||||
|
||||
boolean isExportConfig();
|
||||
|
||||
boolean isdebug();
|
||||
|
||||
void generatePom(Item item);
|
||||
|
||||
void generatePom(Item item, int option);
|
||||
|
||||
@@ -165,6 +165,8 @@ public class ProcessorUtilities {
|
||||
|
||||
private static final Set<String> esbJobs = new HashSet<String>();
|
||||
|
||||
private static boolean isDebug = false;
|
||||
|
||||
public static void addOpenEditor(IEditorPart editor) {
|
||||
openedEditors.add(editor);
|
||||
}
|
||||
@@ -2494,4 +2496,12 @@ public class ProcessorUtilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setDebug(boolean debug) {
|
||||
isDebug = debug;
|
||||
}
|
||||
|
||||
public static boolean isdebug() {
|
||||
return isDebug;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,4 +48,6 @@ public class MavenSystemFolders {
|
||||
public static final ProjectSystemFolder[] TEST_DIRS = { JAVA_TEST, RESOURCES_TEST };
|
||||
|
||||
public static final ProjectSystemFolder[] ALL_DIRS = { JAVA, JAVA_TEST, RESOURCES, RESOURCES_TEST };
|
||||
|
||||
public static final ProjectSystemFolder[] ALL_DIRS_EXT = { JAVA, JAVA_TEST, RESOURCES, RESOURCES_TEST, EXT_RESOURCES };
|
||||
}
|
||||
|
||||
@@ -263,6 +263,12 @@ public class BuildCacheManager {
|
||||
codesLastBuildCache.remove(codeType);
|
||||
}
|
||||
|
||||
public void clearAllCodesCache() {
|
||||
for (ERepositoryObjectType codeType : ERepositoryObjectType.getAllTypesOfCodes()) {
|
||||
codesLastBuildCache.remove(codeType);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllCaches() {
|
||||
jobCache.clear();
|
||||
jobletCache.clear();
|
||||
|
||||
@@ -22,6 +22,8 @@ import java.util.Set;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
|
||||
import org.talend.core.model.properties.Property;
|
||||
@@ -102,8 +104,19 @@ public abstract class AbstractMavenCodesTemplatePom extends AbstractMavenGeneral
|
||||
|
||||
for (ModuleNeeded module : needModules) {
|
||||
Dependency dependency = null;
|
||||
// TDI-37032 add dependency only if jar avialable in maven
|
||||
if (module.getDeployStatus() == ELibraryInstallStatus.DEPLOYED) {
|
||||
// TDI-37032 add dependency only if jar available in maven
|
||||
boolean isDeployed = false;
|
||||
if (module.getDeployStatus() != ELibraryInstallStatus.DEPLOYED) {
|
||||
// try to retrieve from custom Nexus
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ILibraryManagerService.class)) {
|
||||
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
|
||||
.getService(ILibraryManagerService.class);
|
||||
isDeployed = libManagerService.retrieve(module, null, false);
|
||||
}
|
||||
} else {
|
||||
isDeployed = true;
|
||||
}
|
||||
if (isDeployed) {
|
||||
dependency = PomUtil.createModuleDependency(module.getMavenUri());
|
||||
}
|
||||
if (dependency != null) {
|
||||
|
||||
@@ -208,11 +208,12 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
|
||||
Xpp3Dom artifactSet = new Xpp3Dom("artifactSet"); //$NON-NLS-1$
|
||||
configuration.addChild(artifactSet);
|
||||
Xpp3Dom excludes = new Xpp3Dom("excludes"); //$NON-NLS-1$
|
||||
if (!bigDataProcessor.getShadedModulesExclude().isEmpty()) {
|
||||
Set<ModuleNeeded> modules = bigDataProcessor.getShadedModulesExclude();
|
||||
if (!modules.isEmpty()) {
|
||||
artifactSet.addChild(excludes);
|
||||
}
|
||||
|
||||
for (ModuleNeeded module : bigDataProcessor.getShadedModulesExclude()) {
|
||||
for (ModuleNeeded module : modules) {
|
||||
Xpp3Dom include = new Xpp3Dom("exclude"); //$NON-NLS-1$
|
||||
excludes.addChild(include);
|
||||
MavenArtifact mvnArtifact = MavenUrlHelper.parseMvnUrl(module.getMavenUri());
|
||||
|
||||
@@ -16,24 +16,32 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.eclipse.m2e.core.embedder.IMaven;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
@@ -74,6 +82,8 @@ import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
* created by ggu on 4 Feb 2015 Detailled comment
|
||||
@@ -599,54 +609,45 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
MavenTemplateManager.saveContent(infoFile, jobInfoContent, overwrite);
|
||||
}
|
||||
|
||||
public void updateDependencySet(IFile assemblyFile) {
|
||||
final String SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
|
||||
|
||||
String talendlibIncludesTag = "<!--@TalendLibIncludes@-->"; //$NON-NLS-1$
|
||||
String _3rdlibExcludesTag = "<!--@3rdPartyLibIncludes@-->"; //$NON-NLS-1$
|
||||
String jobIncludesTag = "<!--@JobIncludes@-->"; //$NON-NLS-1$
|
||||
|
||||
StringBuilder talendlibIncludes = new StringBuilder();
|
||||
StringBuilder _3rdPartylibExcludes = new StringBuilder();
|
||||
StringBuilder jobIncludes = new StringBuilder();
|
||||
|
||||
Set<String> childrenCoordinate = new HashSet<>();
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
Set<JobInfo> childrenJobInfo = new HashSet<>();
|
||||
if (!hasLoopDependency()) {
|
||||
// add children jobs
|
||||
Set<JobInfo> childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String groupId = PomIdsHelper.getJobGroupId(property);
|
||||
String artifactId = PomIdsHelper.getJobArtifactId(jobInfo);
|
||||
String coordinate = groupId + ":" + artifactId; //$NON-NLS-1$
|
||||
addItem(jobIncludes, coordinate, SEPARATOR);
|
||||
childrenCoordinate.add(coordinate);
|
||||
}
|
||||
childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
}
|
||||
|
||||
// add children jobs
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String coordinate = getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
jobCoordinate.add(coordinate);
|
||||
}
|
||||
|
||||
// add parent job
|
||||
Property parentProperty = this.getJobProcessor().getProperty();
|
||||
String parentCoordinate = PomIdsHelper.getJobGroupId(parentProperty) + ":" //$NON-NLS-1$
|
||||
+ PomIdsHelper.getJobArtifactId(parentProperty);
|
||||
addItem(jobIncludes, parentCoordinate, SEPARATOR);
|
||||
String parentCoordinate = getCoordinate(PomIdsHelper.getJobGroupId(parentProperty),
|
||||
PomIdsHelper.getJobArtifactId(parentProperty), MavenConstants.PACKAGING_JAR,
|
||||
PomIdsHelper.getJobVersion(parentProperty));
|
||||
jobCoordinate.add(parentCoordinate);
|
||||
|
||||
// add talend libraries and codes
|
||||
Set<String> talendLibCoordinate = new HashSet<>();
|
||||
String projectTechName = ProjectManager.getInstance().getProject(parentProperty).getTechnicalLabel();
|
||||
String projectGroupId = PomIdsHelper.getProjectGroupId(projectTechName);
|
||||
|
||||
// codes
|
||||
List<Dependency> dependencies = new ArrayList<>();
|
||||
addCodesDependencies(dependencies);
|
||||
for (Dependency dependency : dependencies) {
|
||||
String dependencyGroupId = dependency.getGroupId();
|
||||
String coordinate = dependencyGroupId + ":" + dependency.getArtifactId(); //$NON-NLS-1$
|
||||
addItem(talendlibIncludes, coordinate, SEPARATOR);
|
||||
talendLibCoordinate.add(coordinate);
|
||||
talendLibCoordinate.add(getCoordinate(dependency));
|
||||
}
|
||||
|
||||
// libraries
|
||||
dependencies.clear();
|
||||
Set<ModuleNeeded> modules =
|
||||
getJobProcessor().getNeededModules(TalendProcessOptionConstants.MODULES_WITH_JOBLET);
|
||||
getJobProcessor().getNeededModules(
|
||||
TalendProcessOptionConstants.MODULES_WITH_JOBLET | TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED);
|
||||
for (ModuleNeeded module : modules) {
|
||||
String mavenUri = module.getMavenUri();
|
||||
Dependency dependency = PomUtil.createModuleDependency(mavenUri);
|
||||
@@ -657,10 +658,9 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
continue;
|
||||
}
|
||||
String dependencyGroupId = dependency.getGroupId();
|
||||
String coordinate = dependencyGroupId + ":" + dependency.getArtifactId(); //$NON-NLS-1$
|
||||
if (!childrenCoordinate.contains(coordinate)) {
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinate.contains(coordinate)) {
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(dependencyGroupId)) {
|
||||
addItem(talendlibIncludes, coordinate, SEPARATOR);
|
||||
talendLibCoordinate.add(coordinate);
|
||||
}
|
||||
}
|
||||
@@ -668,62 +668,176 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
|
||||
|
||||
// add 3rd party libraries
|
||||
Set<String> _3rdDepLib = new HashSet<>();
|
||||
Map<String, Set<Dependency>> duplicateLibs = new HashMap<>();
|
||||
for (Dependency dependency : dependencies) {
|
||||
if (MavenConstants.PACKAGING_POM.equals(dependency.getType())) {
|
||||
continue;
|
||||
}
|
||||
String coordinate = dependency.getGroupId() + ":" + dependency.getArtifactId(); //$NON-NLS-1$
|
||||
if (!childrenCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)) {
|
||||
String coordinate = getCoordinate(dependency);
|
||||
if (!jobCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)) {
|
||||
_3rdDepLib.add(coordinate);
|
||||
addItem(_3rdPartylibExcludes, coordinate, SEPARATOR);
|
||||
addToDuplicateLibs(duplicateLibs, dependency);
|
||||
}
|
||||
}
|
||||
|
||||
// add missing modules from the job generation of children
|
||||
Set<JobInfo> allJobs = LastGenerationInfo.getInstance().getLastGeneratedjobs();
|
||||
Set<ModuleNeeded> fullModulesList = new HashSet<>();
|
||||
for (JobInfo jobInfo : allJobs) {
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
fullModulesList.addAll(LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(jobInfo.getJobId(),
|
||||
jobInfo.getJobVersion()));
|
||||
}
|
||||
for (ModuleNeeded moduleNeeded : fullModulesList) {
|
||||
if (moduleNeeded.isExcluded()) {
|
||||
continue;
|
||||
}
|
||||
MavenArtifact artifact = MavenUrlHelper.parseMvnUrl(moduleNeeded.getMavenUri());
|
||||
String coordinate = artifact.getGroupId() + ":" + artifact.getArtifactId(); //$NON-NLS-1$
|
||||
if (!childrenCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)
|
||||
String coordinate = getCoordinate(artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(),
|
||||
artifact.getVersion());
|
||||
if (!jobCoordinate.contains(coordinate) && !talendLibCoordinate.contains(coordinate)
|
||||
&& !_3rdDepLib.contains(coordinate)) {
|
||||
if (MavenConstants.DEFAULT_LIB_GROUP_ID.equals(artifact.getGroupId())
|
||||
|| artifact.getGroupId().startsWith(projectGroupId)) {
|
||||
addItem(talendlibIncludes, coordinate, SEPARATOR);
|
||||
talendLibCoordinate.add(coordinate);
|
||||
} else {
|
||||
addItem(_3rdPartylibExcludes, coordinate, SEPARATOR);
|
||||
_3rdDepLib.add(coordinate);
|
||||
Dependency dependency = PomUtil.createDependency(artifact.getGroupId(), artifact.getArtifactId(),
|
||||
artifact.getVersion(), artifact.getType(), artifact.getClassifier());
|
||||
addToDuplicateLibs(duplicateLibs, dependency);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_3rdPartylibExcludes.length() == 0) {
|
||||
// if removed, it might add many unwanted dependencies to the libs folder. (or we should simply remove
|
||||
// the full empty block of dependencySet)
|
||||
addItem(_3rdPartylibExcludes, "null:null", SEPARATOR); //$NON-NLS-1$
|
||||
Iterator<String> iterator = duplicateLibs.keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
Set<Dependency> dupDependencies = duplicateLibs.get(key);
|
||||
if (dupDependencies.size() < 2) {
|
||||
// remove non-duplicated dependencies
|
||||
iterator.remove();
|
||||
} else {
|
||||
// remove duplicated dependencies from 3rd lib list
|
||||
for (Dependency dependency : dupDependencies) {
|
||||
_3rdDepLib.remove(getCoordinate(dependency));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String talendLibIncludesStr = StringUtils.removeEnd(talendlibIncludes.toString(), SEPARATOR);
|
||||
String _3rdPartylibExcludesStr = StringUtils.removeEnd(_3rdPartylibExcludes.toString(), SEPARATOR);
|
||||
String jobIncludesStr = StringUtils.removeEnd(jobIncludes.toString(), SEPARATOR);
|
||||
String content = org.talend.commons.utils.io.FilesUtils.readFileContent(assemblyFile);
|
||||
content = StringUtils.replaceEach(content,
|
||||
new String[] { talendlibIncludesTag, _3rdlibExcludesTag, jobIncludesTag },
|
||||
new String[] { talendLibIncludesStr, _3rdPartylibExcludesStr, jobIncludesStr });
|
||||
org.talend.commons.utils.io.FilesUtils.writeContentToFile(content, assemblyFile);
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add talend libs & codes
|
||||
setupDependencySetNode(document, talendLibCoordinate, "lib", "${artifact.artifactId}.${artifact.extension}", false);
|
||||
// add 3rd party libs <dependencySet>
|
||||
setupDependencySetNode(document, _3rdDepLib, "lib", null, false);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, "${talend.job.name}",
|
||||
"${artifact.build.finalName}.${artifact.extension}", true);
|
||||
// add duplicate dependencies if exists
|
||||
setupFileNode(document, duplicateLibs);
|
||||
|
||||
PomUtil.saveAssemblyFile(assemblyFile, document);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void addItem(StringBuilder builder, String coordinate, String separator) {
|
||||
if (builder.length() > 0) {
|
||||
builder.append("\t\t\t\t"); //$NON-NLS-1$
|
||||
private String getCoordinate(Dependency dependency) {
|
||||
return getCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), dependency.getVersion());
|
||||
}
|
||||
|
||||
protected String getCoordinate(String groupId, String artifactId, String type, String version) {
|
||||
String separator = ":"; //$NON-NLS-1$
|
||||
String coordinate = groupId + separator;
|
||||
coordinate += artifactId + separator;
|
||||
if (type != null) {
|
||||
coordinate += type;
|
||||
}
|
||||
if (version != null) {
|
||||
coordinate += separator + version;
|
||||
}
|
||||
return coordinate;
|
||||
}
|
||||
|
||||
private void addToDuplicateLibs(Map<String, Set<Dependency>> map, Dependency dependency) {
|
||||
String coordinate = getCoordinate(dependency.getGroupId(), dependency.getArtifactId(), dependency.getType(), null);
|
||||
if (!map.containsKey(coordinate)) {
|
||||
Set<Dependency> set = new HashSet<>();
|
||||
map.put(coordinate, set);
|
||||
}
|
||||
map.get(coordinate).add(dependency);
|
||||
}
|
||||
|
||||
protected void setupDependencySetNode(Document document, Set<String> libIncludes, String outputDir, String fileNameMapping,
|
||||
boolean useProjectArtifact) {
|
||||
if (libIncludes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Node dependencySetsNode = document.getElementsByTagName("dependencySets").item(0);
|
||||
if (dependencySetsNode == null) {
|
||||
return;
|
||||
}
|
||||
Node dependencySetNode = document.createElement("dependencySet");
|
||||
dependencySetsNode.appendChild(dependencySetNode);
|
||||
|
||||
Node outputDirNode = document.createElement("outputDirectory");
|
||||
outputDirNode.setTextContent(outputDir);
|
||||
dependencySetNode.appendChild(outputDirNode);
|
||||
|
||||
Node includesNode = document.createElement("includes");
|
||||
dependencySetNode.appendChild(includesNode);
|
||||
|
||||
for (String include : libIncludes) {
|
||||
Node includeNode = document.createElement("include");
|
||||
includeNode.setTextContent(include);
|
||||
includesNode.appendChild(includeNode);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(fileNameMapping)) {
|
||||
Node fileNameMappingNode = document.createElement("outputFileNameMapping");
|
||||
fileNameMappingNode.setTextContent(fileNameMapping);
|
||||
dependencySetNode.appendChild(fileNameMappingNode);
|
||||
}
|
||||
|
||||
Node useProjectArtifactNode = document.createElement("useProjectArtifact");
|
||||
useProjectArtifactNode.setTextContent(Boolean.toString(useProjectArtifact));
|
||||
dependencySetNode.appendChild(useProjectArtifactNode);
|
||||
|
||||
}
|
||||
|
||||
private void setupFileNode(Document document, Map<String, Set<Dependency>> duplicateDependencies) {
|
||||
if (duplicateDependencies.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
IMaven maven = MavenPlugin.getMaven();
|
||||
ArtifactRepository repository = maven.getLocalRepository();
|
||||
Node filesNode = document.getElementsByTagName("files").item(0);
|
||||
for (Entry<String, Set<Dependency>> entry : duplicateDependencies.entrySet()) {
|
||||
Set<Dependency> dependencies = entry.getValue();
|
||||
for (Dependency dependency : dependencies) {
|
||||
String sourceLocation = maven.getArtifactPath(repository, dependency.getGroupId(), dependency.getArtifactId(),
|
||||
dependency.getVersion(), dependency.getType(), dependency.getClassifier());
|
||||
Path path = new File(repository.getBasedir()).toPath().resolve(sourceLocation);
|
||||
sourceLocation = path.toString();
|
||||
String destName = path.getFileName().toString();
|
||||
Node fileNode = document.createElement("file");
|
||||
filesNode.appendChild(fileNode);
|
||||
|
||||
Node sourcesNode = document.createElement("source");
|
||||
sourcesNode.setTextContent(sourceLocation);
|
||||
fileNode.appendChild(sourcesNode);
|
||||
|
||||
Node outputDirNode = document.createElement("outputDirectory");
|
||||
outputDirNode.setTextContent("lib");
|
||||
fileNode.appendChild(outputDirNode);
|
||||
|
||||
Node destNameNode = document.createElement("destName");
|
||||
destNameNode.setTextContent(destName);
|
||||
fileNode.appendChild(destNameNode);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
builder.append("<include>"); //$NON-NLS-1$
|
||||
builder.append(coordinate);
|
||||
builder.append("</include>"); //$NON-NLS-1$
|
||||
builder.append(separator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
@@ -35,6 +38,7 @@ import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.relationship.Relation;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.runtime.maven.MavenConstants;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
@@ -43,9 +47,11 @@ import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.template.MavenTemplateManager;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.utils.PomIdsHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.utils.io.FilesUtils;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
/**
|
||||
* @see OSGIJavaScriptForESBWithMavenManager to build job
|
||||
@@ -144,20 +150,29 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
}
|
||||
}
|
||||
model.setName(model.getName() + " Bundle");
|
||||
model.setPackaging("bundle");
|
||||
model.addProperty("talend.job.finalName", "${talend.job.name}-bundle-${project.version}");
|
||||
if (isServiceOperation) {
|
||||
model.addProperty("cloud.publisher.skip", "true");
|
||||
// Build build = model.getBuild();
|
||||
// if(build != null) {
|
||||
// List<Plugin> plugins = build.getPlugins();
|
||||
// for(Plugin p : plugins) {
|
||||
// if(p.getArtifactId().equals("maven-deploy-plugin")) {
|
||||
// build.removePlugin(p);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Build build = model.getBuild();
|
||||
|
||||
List<Plugin> removePlugins = new ArrayList<Plugin>();
|
||||
if (build != null) {
|
||||
List<Plugin> plugins = build.getPlugins();
|
||||
for (Plugin p : plugins) {
|
||||
if (p.getArtifactId().equals("maven-deploy-plugin")) {
|
||||
removePlugins.add(p);
|
||||
}
|
||||
if (p.getArtifactId().equals("maven-bundle-plugin")) {
|
||||
removePlugins.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Plugin p : removePlugins) {
|
||||
build.removePlugin(p);
|
||||
}
|
||||
} else {
|
||||
model.setPackaging("bundle");
|
||||
}
|
||||
|
||||
return model;
|
||||
@@ -196,6 +211,36 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateDependencySet(IFile assemblyFile) {
|
||||
Set<String> jobCoordinate = new HashSet<>();
|
||||
if (!hasLoopDependency()) {
|
||||
// add children jobs
|
||||
Set<JobInfo> childrenJobInfo = getJobProcessor().getBuildChildrenJobs();
|
||||
for (JobInfo jobInfo : childrenJobInfo) {
|
||||
Property property = jobInfo.getProcessItem().getProperty();
|
||||
String coordinate = getCoordinate(PomIdsHelper.getJobGroupId(property), PomIdsHelper.getJobArtifactId(jobInfo),
|
||||
MavenConstants.PACKAGING_JAR, PomIdsHelper.getJobVersion(property));
|
||||
jobCoordinate.add(coordinate);
|
||||
}
|
||||
}
|
||||
// add parent job
|
||||
Property parentProperty = this.getJobProcessor().getProperty();
|
||||
String parentCoordinate = getCoordinate(PomIdsHelper.getJobGroupId(parentProperty),
|
||||
PomIdsHelper.getJobArtifactId(parentProperty), MavenConstants.PACKAGING_JAR,
|
||||
PomIdsHelper.getJobVersion(parentProperty));
|
||||
jobCoordinate.add(parentCoordinate);
|
||||
try {
|
||||
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
|
||||
// add jobs
|
||||
setupDependencySetNode(document, jobCoordinate, "${talend.job.name}",
|
||||
"${artifact.build.finalName}.${artifact.extension}", true);
|
||||
PomUtil.saveAssemblyFile(assemblyFile, document);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
@@ -43,9 +42,11 @@ import org.eclipse.m2e.core.project.ProjectImportConfiguration;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.generation.JavaUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.designer.maven.model.MavenSystemFolders;
|
||||
import org.talend.designer.maven.model.ProjectSystemFolder;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
|
||||
/**
|
||||
* DOC zwxue class global comment. Detailled comment
|
||||
@@ -93,8 +94,17 @@ public class MavenProjectUtils {
|
||||
return;
|
||||
}
|
||||
MavenPlugin.getProjectConfigurationManager().updateProjectConfiguration(project, monitor);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
|
||||
changeClasspath(monitor, project);
|
||||
if (service.isdebug()) {
|
||||
changeClasspath(monitor, project, MavenSystemFolders.ALL_DIRS_EXT);
|
||||
} else {
|
||||
|
||||
changeClasspath(monitor, project);
|
||||
}
|
||||
}
|
||||
|
||||
// only need this when pom has no parent.
|
||||
// IJavaProject javaProject = JavaCore.create(project);
|
||||
@@ -102,6 +112,10 @@ public class MavenProjectUtils {
|
||||
}
|
||||
|
||||
public static void changeClasspath(IProgressMonitor monitor, IProject p) {
|
||||
changeClasspath(monitor, p, MavenSystemFolders.ALL_DIRS);
|
||||
}
|
||||
|
||||
public static void changeClasspath(IProgressMonitor monitor, IProject p, ProjectSystemFolder[] folders) {
|
||||
try {
|
||||
if (!p.hasNature(JavaCore.NATURE_ID)) {
|
||||
JavaUtils.addJavaNature(p, monitor);
|
||||
@@ -111,7 +125,7 @@ public class MavenProjectUtils {
|
||||
|
||||
List<IClasspathEntry> list = new LinkedList<>();
|
||||
ClasspathAttribute attribute = new ClasspathAttribute("maven.pomderived", Boolean.TRUE.toString());
|
||||
for (ProjectSystemFolder psf : MavenSystemFolders.ALL_DIRS) {
|
||||
for (ProjectSystemFolder psf : folders) {
|
||||
IFolder resources = p.getFolder(psf.getPath());
|
||||
if (resources.exists()) { // add the condition mostly for routines, since the resources folder might not exist
|
||||
IFolder output = p.getFolder(psf.getOutputPath());
|
||||
@@ -142,6 +156,7 @@ public class MavenProjectUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear compliance settings from project, and set them into Eclipse compliance settings
|
||||
*
|
||||
|
||||
@@ -92,9 +92,13 @@ import org.talend.designer.maven.tools.ProcessorDependenciesManager;
|
||||
import org.talend.designer.runprocess.IProcessor;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.w3c.dom.Attr;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.ls.DOMImplementationLS;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
@@ -793,6 +797,21 @@ public class PomUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveAssemblyFile(IFile assemblyFile, Document document) throws IOException {
|
||||
DOMImplementation implementation = document.getImplementation();
|
||||
if (implementation.hasFeature("LS", "3.0")) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
DOMImplementationLS implementationLS = (DOMImplementationLS) implementation.getFeature("LS", "3.0"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
LSSerializer serializer = implementationLS.createLSSerializer();
|
||||
serializer.getDomConfig().setParameter("format-pretty-print", true); //$NON-NLS-1$
|
||||
try (FileWriter writer = new FileWriter(assemblyFile.getLocation().toFile())) {
|
||||
LSOutput output = implementationLS.createLSOutput();
|
||||
output.setEncoding("UTF-8"); //$NON-NLS-1$
|
||||
output.setCharacterStream(writer);
|
||||
serializer.write(document, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void updatePomDependenciesFromProcessor(IProcessor processor) throws Exception {
|
||||
// .Java project
|
||||
IFile pomFile = processor.getTalendJavaProject().getProjectPom();
|
||||
|
||||
@@ -1321,34 +1321,21 @@ public final class DBConnectionContextUtils {
|
||||
}
|
||||
}
|
||||
|
||||
// Added 20130311 TDQ-7000, when it is context mode and not general jdbc, reset the url.
|
||||
if (contextType != null
|
||||
&& !EDatabaseTypeName.GENERAL_JDBC
|
||||
.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
|
||||
String newURL = null;
|
||||
if (EDatabaseTypeName.IMPALA.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
|
||||
newURL =
|
||||
DatabaseConnStrUtil.getImpalaString(cloneConn, cloneConn.getServerName(), cloneConn.getPort(),
|
||||
cloneConn.getSID(), DbConnStrForHive.URL_HIVE_2_TEMPLATE);
|
||||
} else {
|
||||
newURL =
|
||||
DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(), dbConn.getDbVersionString(),
|
||||
server, username, password, port, sidOrDatabase, filePath.toLowerCase(), datasource,
|
||||
dbRootPath, additionParam);
|
||||
}
|
||||
cloneConn.setURL(newURL);
|
||||
return cloneConn;
|
||||
}// ~
|
||||
|
||||
if (dbConn.getURL() != null && !dbConn.getURL().equals("") && EDatabaseTypeName.GENERAL_JDBC
|
||||
.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) { //$NON-NLS-1$
|
||||
if (dbConn.getURL() != null && !dbConn.getURL().equals("") //$NON-NLS-1$
|
||||
&& EDatabaseTypeName.GENERAL_JDBC.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
|
||||
cloneConn.setURL(url);
|
||||
return cloneConn;
|
||||
}
|
||||
String newURL =
|
||||
DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(), dbConn.getDbVersionString(), server,
|
||||
username, password, port, sidOrDatabase, filePath.toLowerCase(), datasource, dbRootPath,
|
||||
additionParam);
|
||||
|
||||
// Added 20130311 TDQ-7000, when it is context mode and not general jdbc, reset the url.
|
||||
String newURL = null;
|
||||
if (EDatabaseTypeName.IMPALA.equals(EDatabaseTypeName.getTypeFromDbType(dbConn.getDatabaseType()))) {
|
||||
newURL = DatabaseConnStrUtil.getImpalaString(cloneConn, cloneConn.getServerName(), cloneConn.getPort(),
|
||||
cloneConn.getSID(), DbConnStrForHive.URL_HIVE_2_TEMPLATE);
|
||||
} else {
|
||||
newURL = DatabaseConnStrUtil.getURLString(cloneConn.getDatabaseType(), dbConn.getDbVersionString(), server, username,
|
||||
password, port, sidOrDatabase, filePath.toLowerCase(), datasource, dbRootPath, additionParam);
|
||||
}
|
||||
cloneConn.setURL(newURL);
|
||||
return cloneConn;
|
||||
}
|
||||
|
||||
@@ -218,6 +218,12 @@ public final class XsdMetadataUtils {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (node == null) {
|
||||
// no declaration in the present XSD
|
||||
return;
|
||||
}
|
||||
|
||||
node = populationUtil.getSchemaTree(xsdSchema, node);
|
||||
orderId = 1;
|
||||
loopElementFound = false;
|
||||
|
||||
@@ -3623,6 +3623,12 @@ public class LocalRepositoryFactory extends AbstractEMFRepositoryFactory impleme
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadProjectAndSetContext(Project project, IProject eclipseProject, boolean updateCurrentProject)
|
||||
throws PersistenceException {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
public void initProjectRepository(Project project, String branchForMainProject) throws PersistenceException {
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -36,6 +36,11 @@
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.metadata.managment.ui.utils;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.database.conn.ConnParameterKeys;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class DBConnectionContextUtilsTest {
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
@Test
|
||||
public void testCloneOriginalValueConnectionImpala() {
|
||||
final String EXPECT_URL = "jdbc:hive2://tal-qa146.talend.lan:21050/default;principal=impala/tal-qa146.talend.lan@CDH.ONE";
|
||||
DatabaseConnection originalConn = ConnectionFactoryImpl.eINSTANCE.createDatabaseConnection();
|
||||
originalConn.setDatabaseType(EDatabaseTypeName.IMPALA.getXmlName());
|
||||
originalConn.setServerName("tal-qa146.talend.lan");
|
||||
originalConn.setPort("21050");
|
||||
originalConn.setSID("default");
|
||||
originalConn.getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USE_KRB, Boolean.TRUE.toString());
|
||||
originalConn.getParameters().put(ConnParameterKeys.IMPALA_AUTHENTICATION_PRINCIPLA,
|
||||
"impala/tal-qa146.talend.lan@CDH.ONE");
|
||||
DatabaseConnection clonedConn = DBConnectionContextUtils.cloneOriginalValueConnection(originalConn, false, null);
|
||||
Assert.assertEquals(EXPECT_URL, clonedConn.getURL());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user