Search in sources :

Example 1 with ConfigSchema

use of org.apache.nifi.minifi.commons.schema.ConfigSchema in project nifi-minifi by apache.

the class SchemaLoaderTest method testMinimalConfigV2Version.

@Test
public void testMinimalConfigV2Version() throws IOException, SchemaLoaderException {
    Map<String, Object> yamlAsMap = SchemaLoader.loadYamlAsMap(SchemaLoaderTest.class.getClassLoader().getResourceAsStream("config-minimal-v2.yml"));
    yamlAsMap.put(ConfigSchema.VERSION, ConfigSchema.CONFIG_VERSION);
    ConfigSchema configSchema = SchemaLoader.loadConfigSchemaFromYaml(yamlAsMap);
    validateMinimalConfigVersion1Parse(configSchema);
}
Also used : ConfigSchema(org.apache.nifi.minifi.commons.schema.ConfigSchema) Test(org.junit.Test)

Example 2 with ConfigSchema

use of org.apache.nifi.minifi.commons.schema.ConfigSchema in project nifi-minifi by apache.

the class SchemaLoaderTest method testMinimalConfigV1Version.

@Test
public void testMinimalConfigV1Version() throws IOException, SchemaLoaderException {
    Map<String, Object> yamlAsMap = SchemaLoader.loadYamlAsMap(SchemaLoaderTest.class.getClassLoader().getResourceAsStream("config-minimal.yml"));
    yamlAsMap.put(ConfigSchema.VERSION, ConfigSchemaV1.CONFIG_VERSION);
    ConfigSchema configSchema = SchemaLoader.loadConfigSchemaFromYaml(yamlAsMap);
    validateMinimalConfigVersion1Parse(configSchema);
}
Also used : ConfigSchema(org.apache.nifi.minifi.commons.schema.ConfigSchema) Test(org.junit.Test)

Example 3 with ConfigSchema

use of org.apache.nifi.minifi.commons.schema.ConfigSchema in project nifi-minifi by apache.

the class SchemaLoaderTest method testMinimalConfigV3Version.

@Test
public void testMinimalConfigV3Version() throws IOException, SchemaLoaderException {
    Map<String, Object> yamlAsMap = SchemaLoader.loadYamlAsMap(SchemaLoaderTest.class.getClassLoader().getResourceAsStream("config-minimal-v3.yml"));
    yamlAsMap.put(ConfigSchema.VERSION, ConfigSchema.CONFIG_VERSION);
    ConfigSchema configSchema = SchemaLoader.loadConfigSchemaFromYaml(yamlAsMap);
    validateMinimalConfigVersion1Parse(configSchema);
}
Also used : ConfigSchema(org.apache.nifi.minifi.commons.schema.ConfigSchema) Test(org.junit.Test)

Example 4 with ConfigSchema

use of org.apache.nifi.minifi.commons.schema.ConfigSchema in project nifi-minifi by apache.

the class SchemaLoaderTest method testMinimalConfigNoVersion.

@Test
public void testMinimalConfigNoVersion() throws IOException, SchemaLoaderException {
    ConfigSchema configSchema = SchemaLoader.loadConfigSchemaFromYaml(SchemaLoaderTest.class.getClassLoader().getResourceAsStream("config-minimal.yml"));
    validateMinimalConfigVersion1Parse(configSchema);
}
Also used : ConfigSchema(org.apache.nifi.minifi.commons.schema.ConfigSchema) Test(org.junit.Test)

Example 5 with ConfigSchema

use of org.apache.nifi.minifi.commons.schema.ConfigSchema in project nifi-minifi by apache.

the class ConnectionSchemaV1Test method testConnectionGeneratedIds.

@Test
public void testConnectionGeneratedIds() {
    List<Map<String, Object>> listWithKeyValues = getListWithKeyValues(CommonPropertyKeys.NAME_KEY, "test", "test", "test_2", "test", "test_2");
    ConfigSchema configSchema = new ConfigSchemaV1(Collections.singletonMap(CommonPropertyKeys.CONNECTIONS_KEY, listWithKeyValues)).convert();
    assertMessageDoesNotExist(configSchema, ConfigSchema.FOUND_THE_FOLLOWING_DUPLICATE_CONNECTION_IDS);
    List<ConnectionSchema> connections = configSchema.getProcessGroupSchema().getConnections();
    assertEquals(5, connections.size());
    // Generated unique ids
    assertEquals("098f6bcd-4621-3373-8ade-4e832627b4f6", connections.get(0).getId());
    assertEquals("098f6bcd-4621-3373-8ade-4e832627b4f7", connections.get(1).getId());
    assertEquals("b9dacbc6-7962-39a9-9e45-394e2cf0dbf6", connections.get(2).getId());
    assertEquals("098f6bcd-4621-3373-8ade-4e832627b4f8", connections.get(3).getId());
    assertEquals("b9dacbc6-7962-39a9-9e45-394e2cf0dbf7", connections.get(4).getId());
}
Also used : ConnectionSchema(org.apache.nifi.minifi.commons.schema.ConnectionSchema) HashMap(java.util.HashMap) Map(java.util.Map) ConfigSchema(org.apache.nifi.minifi.commons.schema.ConfigSchema) Test(org.junit.Test)

Aggregations

ConfigSchema (org.apache.nifi.minifi.commons.schema.ConfigSchema)31 Test (org.junit.Test)20 InputStream (java.io.InputStream)7 HashMap (java.util.HashMap)6 Map (java.util.Map)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 IOException (java.io.IOException)5 FileInputStream (java.io.FileInputStream)4 List (java.util.List)4 JAXBException (javax.xml.bind.JAXBException)4 FileNotFoundException (java.io.FileNotFoundException)3 OutputStream (java.io.OutputStream)3 ArrayList (java.util.ArrayList)3 Properties (java.util.Properties)3 ConfigSchemaTest (org.apache.nifi.minifi.commons.schema.ConfigSchemaTest)3 ConnectionSchema (org.apache.nifi.minifi.commons.schema.ConnectionSchema)3 HttpURLConnection (java.net.HttpURLConnection)2 ByteBuffer (java.nio.ByteBuffer)2 HashSet (java.util.HashSet)2