Search in sources :

Example 1 with AbstractDragAndDropServiceHandler

use of org.talend.core.model.utils.AbstractDragAndDropServiceHandler in project tdi-studio-se by Talend.

the class GenericDragAndDropHandlerTest method testIsGenericRepositoryValue.

@Test
public void testIsGenericRepositoryValue() {
    Connection connection = mock(Connection.class);
    AbstractDragAndDropServiceHandler abstractDragAndDropServiceHandler = mock(AbstractDragAndDropServiceHandler.class);
    List<ComponentProperties> componentProsList = new ArrayList<>();
    boolean isGenericRepositoryValue = abstractDragAndDropServiceHandler.isGenericRepositoryValue(componentProsList, //$NON-NLS-1$
    "paramName1");
    assertEquals(false, isGenericRepositoryValue);
    connection = mock(GenericConnection.class);
    GenericDragAndDropHandler genericDragAndDropHandler = mock(GenericDragAndDropHandler.class);
    when(genericDragAndDropHandler.canHandle(connection)).thenReturn(true);
    //$NON-NLS-1$
    isGenericRepositoryValue = genericDragAndDropHandler.isGenericRepositoryValue(null, "paramName2");
    assertEquals(false, isGenericRepositoryValue);
// PowerMockito.mockStatic(ComponentsUtils.class);
// ComponentProperties mockComponentProperties = mock(ComponentProperties.class);
// when(ComponentsUtils.getComponentPropertiesFromSerialized(null)).thenReturn(mockComponentProperties);
// List<Property> propertyValues = new ArrayList<Property>();
// Property element = ComponentPropertyFactory.newReturnsProperty();
// propertyValues.add(element);
// when(ComponentsUtils.getAllValuedProperties(mockComponentProperties)).thenReturn(propertyValues);
//        isGenericRepositoryValue = genericDragAndDropHandler.isGenericRepositoryValue(connection, "QueryMode");//$NON-NLS-1$
// assertEquals(true, isGenericRepositoryValue);
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) GenericConnection(org.talend.repository.generic.model.genericMetadata.GenericConnection) AbstractDragAndDropServiceHandler(org.talend.core.model.utils.AbstractDragAndDropServiceHandler) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 ComponentProperties (org.talend.components.api.properties.ComponentProperties)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 AbstractDragAndDropServiceHandler (org.talend.core.model.utils.AbstractDragAndDropServiceHandler)1 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)1