Search in sources :

Example 46 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project components by Talend.

the class SnowflakeWritersTestIT method testSchemaSerialized2.

@Test
public void testSchemaSerialized2() throws Throwable {
    ComponentDefinition definition = getComponentService().getComponentDefinition(TSnowflakeOutputDefinition.COMPONENT_NAME);
    TSnowflakeOutputProperties outputProps = (TSnowflakeOutputProperties) getComponentService().getComponentProperties(TSnowflakeOutputDefinition.COMPONENT_NAME);
    Schema reject = SchemaBuilder.record("Reject").fields().name("A").type().stringType().noDefault().name("B").type().stringType().noDefault().endRecord();
    Schema main = SchemaBuilder.record("Main").fields().name("C").type().stringType().noDefault().name("D").type().stringType().noDefault().endRecord();
    outputProps.setValue("table.main.schema", main);
    outputProps.setValue("schemaReject.schema", reject);
    Schema main2 = (Schema) outputProps.getValuedProperty("table.main.schema").getValue();
    Schema reject2 = (Schema) outputProps.getValuedProperty("schemaReject.schema").getValue();
    assertEquals(main.toString(), main2.toString());
    assertEquals(reject.toString(), reject2.toString());
    String serialized = outputProps.toSerialized();
    TSnowflakeOutputProperties afterSerialized = org.talend.daikon.properties.Properties.Helper.fromSerializedPersistent(serialized, TSnowflakeOutputProperties.class).object;
    main2 = (Schema) afterSerialized.getValuedProperty("table.main.schema").getValue();
    reject2 = (Schema) afterSerialized.getValuedProperty("schemaReject.schema").getValue();
    assertEquals(main.toString(), main2.toString());
    assertEquals(reject.toString(), reject2.toString());
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties) Schema(org.apache.avro.Schema) Matchers.containsString(org.hamcrest.Matchers.containsString) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) Test(org.junit.Test)

Example 47 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project components by Talend.

the class SpringSnowflakeTestIT method testFamily.

@Test
public void testFamily() {
    ComponentDefinition cd = getComponentService().getComponentDefinition("tSnowflakeConnection");
    assertEquals(1, cd.getFamilies().length);
    assertEquals("Cloud/Snowflake", cd.getFamilies()[0]);
}
Also used : ComponentDefinition(org.talend.components.api.component.ComponentDefinition) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

ComponentDefinition (org.talend.components.api.component.ComponentDefinition)47 Test (org.junit.Test)28 IndexedRecord (org.apache.avro.generic.IndexedRecord)16 TSalesforceOutputProperties (org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties)14 TSalesforceOutputDefinition (org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputDefinition)12 ArrayList (java.util.ArrayList)11 Result (org.talend.components.api.component.runtime.Result)11 TSalesforceInputProperties (org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties)10 List (java.util.List)9 DefaultComponentRuntimeContainerImpl (org.talend.components.api.container.DefaultComponentRuntimeContainerImpl)8 ComponentProperties (org.talend.components.api.properties.ComponentProperties)7 Schema (org.apache.avro.Schema)6 DefinitionDTO (org.talend.components.service.rest.dto.DefinitionDTO)6 MockComponentDefinition (org.talend.components.service.rest.mock.MockComponentDefinition)6 Response (com.jayway.restassured.response.Response)5 Arrays.asList (java.util.Arrays.asList)5 GenericData (org.apache.avro.generic.GenericData)3 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)3 IComponent (org.talend.core.model.components.IComponent)3 File (java.io.File)2