Search in sources :

Example 16 with ITalendProcessJavaProject

use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.

the class JobJavaScriptsManager method getSrcRootLocation.

/**
     * Get the path of .JAVA/src
     * 
     * @throws Exception
     */
protected IPath getSrcRootLocation() throws Exception {
    ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
    if (talendProcessJavaProject == null) {
        //$NON-NLS-1$
        return new Path("");
    }
    IProject project = talendProcessJavaProject.getProject();
    IJavaProject javaProject = talendProcessJavaProject.getJavaProject();
    IPackageFragmentRoot[] pp = javaProject.getAllPackageFragmentRoots();
    IPackageFragmentRoot src = null;
    for (IPackageFragmentRoot root : pp) {
        if (root.getKind() == IPackageFragmentRoot.K_SOURCE) {
            src = root;
            break;
        }
    }
    IPath root = project.getParent().getLocation();
    root = root.append(src.getPath());
    return root;
}
Also used : Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IJavaProject(org.eclipse.jdt.core.IJavaProject) IPath(org.eclipse.core.runtime.IPath) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) IProject(org.eclipse.core.resources.IProject) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot)

Example 17 with ITalendProcessJavaProject

use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.

the class StandardJobStandaloneBuildProviderTest method test_createPomCreator_nonAssemblyFile.

@Test
public void test_createPomCreator_nonAssemblyFile() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
    ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
    parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
    parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
    parameters.put(IBuildPomCreatorParameters.FILE_ASSEMBLY, new Object());
    RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
    Assert.assertNull(provider.createPomCreator(parameters));
}
Also used : HashMap(java.util.HashMap) RepositoryObjectTypeBuildProvider(org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) Test(org.junit.Test)

Example 18 with ITalendProcessJavaProject

use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.

the class StandardJobStandaloneBuildProviderTest method test_createPomCreator_nullAssemblyFile.

@Test
public void test_createPomCreator_nullAssemblyFile() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
    ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
    parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
    parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
    // parameters.put(IBuildPomCreatorParameters.FILE_ASSEMBLY, null);
    RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
    Assert.assertNull(provider.createPomCreator(parameters));
}
Also used : HashMap(java.util.HashMap) RepositoryObjectTypeBuildProvider(org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) Test(org.junit.Test)

Example 19 with ITalendProcessJavaProject

use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.

the class AbstractStandardJobBuildProviderTest method test_createPomCreator_nonArgumentsMap.

@Test
public void test_createPomCreator_nonArgumentsMap() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
    ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
    parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
    parameters.put(IBuildParametes.ITEM, PropertiesFactory.eINSTANCE.createProcessItem());
    parameters.put(IBuildPomCreatorParameters.ARGUMENTS_MAP, new Object());
    RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
    Assert.assertNull(provider.createPomCreator(parameters));
}
Also used : HashMap(java.util.HashMap) RepositoryObjectTypeBuildProvider(org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) Test(org.junit.Test)

Example 20 with ITalendProcessJavaProject

use of org.talend.core.runtime.process.ITalendProcessJavaProject in project tdi-studio-se by Talend.

the class AbstractStandardJobBuildProviderTest method test_createPomCreator_nonItem.

@Test
public void test_createPomCreator_nonItem() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(IBuildPomCreatorParameters.PROCESSOR, new TestProcessor());
    ITalendProcessJavaProject talendProcessJavaProject = RepositoryPlugin.getDefault().getRunProcessService().getTalendProcessJavaProject();
    parameters.put(IBuildPomCreatorParameters.FILE_POM, talendProcessJavaProject.getProject().getFile("pom_abc.xml"));
    parameters.put(IBuildParametes.ITEM, new Object());
    RepositoryObjectTypeBuildProvider provider = createTestBuildProvider();
    Assert.assertNull(provider.createPomCreator(parameters));
}
Also used : HashMap(java.util.HashMap) RepositoryObjectTypeBuildProvider(org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) Test(org.junit.Test)

Aggregations

ITalendProcessJavaProject (org.talend.core.runtime.process.ITalendProcessJavaProject)49 IRunProcessService (org.talend.designer.runprocess.IRunProcessService)27 IFolder (org.eclipse.core.resources.IFolder)25 IFile (org.eclipse.core.resources.IFile)17 CoreException (org.eclipse.core.runtime.CoreException)16 IOException (java.io.IOException)12 File (java.io.File)11 ArrayList (java.util.ArrayList)11 IPath (org.eclipse.core.runtime.IPath)11 URL (java.net.URL)10 PersistenceException (org.talend.commons.exception.PersistenceException)9 MalformedURLException (java.net.MalformedURLException)8 HashMap (java.util.HashMap)8 ProcessorException (org.talend.designer.runprocess.ProcessorException)8 IProject (org.eclipse.core.resources.IProject)7 Test (org.junit.Test)7 RepositoryObjectTypeBuildProvider (org.talend.core.runtime.repository.build.RepositoryObjectTypeBuildProvider)7 DocumentException (org.dom4j.DocumentException)6 Path (org.eclipse.core.runtime.Path)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4