use of io.cdap.cdap.api.plugin.PluginPropertyField in project cdap by caskdata.
the class DefaultArtifactInspectorTest method inspectAppsAndPlugins.
@Test
public void inspectAppsAndPlugins() throws Exception {
File appFile = getAppFile();
Id.Artifact artifactId = Id.Artifact.from(Id.Namespace.DEFAULT, "InspectionApp", "1.0.0");
Location artifactLocation = Locations.toLocation(appFile);
List<ArtifactDescriptor> parentDescriptor = new ArrayList<>();
parentDescriptor.add(new ArtifactDescriptor(artifactId.getNamespace().getId(), artifactId.toArtifactId(), artifactLocation));
ArtifactClasses classes = artifactInspector.inspectArtifact(artifactId, appFile, parentDescriptor, Collections.emptySet()).getArtifactClasses();
// check app classes
Set<ApplicationClass> expectedApps = ImmutableSet.of(new ApplicationClass(InspectionApp.class.getName(), "", new ReflectionSchemaGenerator(false).generate(InspectionApp.AConfig.class), new Requirements(Collections.emptySet(), Collections.singleton("cdc"))));
Assert.assertEquals(expectedApps, classes.getApps());
// check plugin classes
PluginClass expectedPlugin = PluginClass.builder().setName(InspectionApp.PLUGIN_NAME).setType(InspectionApp.PLUGIN_TYPE).setDescription(InspectionApp.PLUGIN_DESCRIPTION).setClassName(InspectionApp.AppPlugin.class.getName()).setConfigFieldName("pluginConf").setProperties(ImmutableMap.of("y", new PluginPropertyField("y", "", "double", true, true), "isSomething", new PluginPropertyField("isSomething", "", "boolean", true, false))).build();
PluginClass multipleRequirementPlugin = PluginClass.builder().setName(InspectionApp.MULTIPLE_REQUIREMENTS_PLUGIN).setType(InspectionApp.PLUGIN_TYPE).setCategory(InspectionApp.PLUGIN_CATEGORY).setClassName(InspectionApp.MultipleRequirementsPlugin.class.getName()).setConfigFieldName("pluginConf").setProperties(ImmutableMap.of("y", new PluginPropertyField("y", "", "double", true, true), "isSomething", new PluginPropertyField("isSomething", "", "boolean", true, false))).setRequirements(new Requirements(ImmutableSet.of(Table.TYPE, KeyValueTable.TYPE))).setDescription(InspectionApp.PLUGIN_DESCRIPTION).build();
Assert.assertTrue(classes.getPlugins().containsAll(ImmutableSet.of(expectedPlugin, multipleRequirementPlugin)));
}
use of io.cdap.cdap.api.plugin.PluginPropertyField in project cdap by caskdata.
the class FilterErrorTransform method getPluginClass.
private static PluginClass getPluginClass() {
Map<String, PluginPropertyField> properties = new HashMap<>();
properties.put("code", new PluginPropertyField("code", "", "int", true, false));
return PluginClass.builder().setName("Filter").setType(ErrorTransform.PLUGIN_TYPE).setDescription("").setClassName(FilterErrorTransform.class.getName()).setProperties(properties).setConfigFieldName("config").build();
}
use of io.cdap.cdap.api.plugin.PluginPropertyField in project cdap by caskdata.
the class NullFieldSplitterTransform method getPluginClass.
private static PluginClass getPluginClass() {
Map<String, PluginPropertyField> properties = new HashMap<>();
properties.put("field", new PluginPropertyField("field", "", "string", true, true));
return PluginClass.builder().setName("NullFieldSplitter").setType(SplitterTransform.PLUGIN_TYPE).setDescription("").setClassName(NullFieldSplitterTransform.class.getName()).setProperties(properties).setConfigFieldName("config").build();
}
use of io.cdap.cdap.api.plugin.PluginPropertyField in project cdap by caskdata.
the class SleepTransform method getPluginClass.
private static PluginClass getPluginClass() {
Map<String, PluginPropertyField> properties = new HashMap<>();
properties.put("millis", new PluginPropertyField("millis", "", "long", false, false));
return PluginClass.builder().setName("Sleep").setType(Transform.PLUGIN_TYPE).setDescription("").setClassName(SleepTransform.class.getName()).setProperties(properties).setConfigFieldName("config").build();
}
use of io.cdap.cdap.api.plugin.PluginPropertyField in project cdap by caskdata.
the class MockSource method getPluginClass.
private static PluginClass getPluginClass() {
Map<String, PluginPropertyField> properties = new HashMap<>();
properties.put("schema", new PluginPropertyField("schema", "", "string", true, false));
properties.put("records", new PluginPropertyField("records", "", "string", true, false));
properties.put("intervalMillis", new PluginPropertyField("intervalMillis", "", "long", false, false));
properties.put("referenceName", new PluginPropertyField("referenceName", "", "string", false, false));
return PluginClass.builder().setName("Mock").setType(StreamingSource.PLUGIN_TYPE).setDescription("").setClassName(MockSource.class.getName()).setProperties(properties).setConfigFieldName("conf").build();
}
Aggregations