Search in sources :

Example 66 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class AbstractStandardJobBuildProviderTest method createJobItem.

protected Item createJobItem() throws PersistenceException {
    final IProxyRepositoryFactory repositoryFactory = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    final String testJobId = repositoryFactory.getNextId();
    final String testJobLabel = StandardJobStandaloneBuildProvider.class.getSimpleName() + System.currentTimeMillis();
    // copied from NewProcessWizard
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    property.setStatusCode("");
    property.setId(testJobId);
    property.setDisplayName(testJobLabel);
    property.setLabel(property.getDisplayName());
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    processItem.setProperty(property);
    property.setItem(processItem);
    ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
    ParametersType parameterType = TalendFileFactory.eINSTANCE.createParametersType();
    List<RoutinesParameterType> dependenciesInPreference = RoutinesUtil.createDependenciesInPreference();
    parameterType.getRoutinesParameter().addAll(dependenciesInPreference);
    process.setParameters(parameterType);
    processItem.setProcess(process);
    repositoryFactory.create(processItem, new Path(""));
    return processItem;
}
Also used : Path(org.eclipse.core.runtime.Path) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProcessItem(org.talend.core.model.properties.ProcessItem) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 67 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class DemosImportTest method getUserRoutineSize.

protected int getUserRoutineSize() throws PersistenceException {
    List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.ROUTINES);
    int currentRoutineItemsSize = 0;
    for (IRepositoryViewObject obj : all) {
        Property property = obj.getProperty();
        Item item = property.getItem();
        if (item instanceof RoutineItem && !((RoutineItem) item).isBuiltIn()) {
            // only check for user routine.
            currentRoutineItemsSize++;
        }
    }
    return currentRoutineItemsSize;
}
Also used : RoutineItem(org.talend.core.model.properties.RoutineItem) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RoutineItem(org.talend.core.model.properties.RoutineItem) Property(org.talend.core.model.properties.Property)

Example 68 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class FixUnevenItemContextParametersMigrationTaskTest method createTempProcessItem.

private ProcessItem createTempProcessItem() throws PersistenceException {
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    Property myProperty = PropertiesFactory.eINSTANCE.createProperty();
    myProperty.setId(ProxyRepositoryFactory.getInstance().getNextId());
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(false);
    itemState.setPath("");
    processItem.setState(itemState);
    processItem.setProperty(myProperty);
    myProperty.setLabel("myJob");
    myProperty.setVersion("0.1");
    processItem.setProcess(TalendFileFactory.eINSTANCE.createProcessType());
    ProxyRepositoryFactory.getInstance().create(processItem, new Path(""));
    return processItem;
}
Also used : Path(org.eclipse.core.runtime.Path) ProcessItem(org.talend.core.model.properties.ProcessItem) ItemState(org.talend.core.model.properties.ItemState) Property(org.talend.core.model.properties.Property)

Example 69 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class BuildJobFactoryTest method test_createBuildJobHandler_JobExportType_null.

@Test
public void test_createBuildJobHandler_JobExportType_null() {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setLabel("ABC");
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    //$NON-NLS-1$
    property.setStatusCode("");
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    processItem.setProperty(property);
    IBuildJobHandler handler = BuildJobFactory.createBuildJobHandler(processItem, "Default", property.getVersion(), JobScriptsManagerFactory.getDefaultExportChoiceMap(), (JobExportType) null);
    Assert.assertNotNull("Can't build job for standalone job", handler);
    Assert.assertEquals(BuildJobHandler.class.getName(), handler.getClass().getName());
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) BuildJobHandler(org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 70 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class BuildJobFactoryTest method test_createBuildJobHandler_JobExportType_POJO.

@Test
public void test_createBuildJobHandler_JobExportType_POJO() {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setLabel("ABC");
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    //$NON-NLS-1$
    property.setStatusCode("");
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    processItem.setProperty(property);
    IBuildJobHandler handler = BuildJobFactory.createBuildJobHandler(processItem, "Default", property.getVersion(), JobScriptsManagerFactory.getDefaultExportChoiceMap(), JobExportType.POJO);
    Assert.assertNotNull("Can't build job for standalone job", handler);
    Assert.assertEquals(BuildJobHandler.class.getName(), handler.getClass().getName());
}
Also used : ProcessItem(org.talend.core.model.properties.ProcessItem) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) BuildJobHandler(org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler) IBuildJobHandler(org.talend.core.runtime.process.IBuildJobHandler) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Aggregations

Property (org.talend.core.model.properties.Property)147 PersistenceException (org.talend.commons.exception.PersistenceException)56 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)48 Item (org.talend.core.model.properties.Item)46 ProcessItem (org.talend.core.model.properties.ProcessItem)39 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)36 Node (org.talend.designer.core.ui.editor.nodes.Node)28 Process (org.talend.designer.core.ui.editor.process.Process)23 RepositoryNode (org.talend.repository.model.RepositoryNode)22 IElementParameter (org.talend.core.model.process.IElementParameter)21 ConnectionItem (org.talend.core.model.properties.ConnectionItem)21 IDynamicProperty (org.talend.core.ui.properties.tab.IDynamicProperty)21 ArrayList (java.util.ArrayList)20 Test (org.junit.Test)19 INode (org.talend.core.model.process.INode)19 IComponent (org.talend.core.model.components.IComponent)15 Connection (org.talend.core.model.metadata.builder.connection.Connection)14 IProcess2 (org.talend.core.model.process.IProcess2)14 List (java.util.List)12 IFile (org.eclipse.core.resources.IFile)12