ProcessGroupSchema extends BaseSchemaWithIdAndName implements WritableSchema, ConvertableSchema<ProcessGroupSchema> { public Map<String, Object> toMap() { Map<String, Object> result = mapSupplier.get(); String id = getId(); if (!ID_DEFAULT.equals(id)) { result.put(ID_KEY, id); } StringUtil.doIfNotNullOrEmpty(getName(), name -> result.put(NAME_KEY, name)); putListIfNotNull(result, PROCESSORS_KEY, processors); putListIfNotNull(result, CONTROLLER_SERVICES_KEY, controllerServiceSchemas); putListIfNotNull(result, PROCESS_GROUPS_KEY, processGroupSchemas); putListIfNotNull(result, INPUT_PORTS_KEY, inputPortSchemas); putListIfNotNull(result, OUTPUT_PORTS_KEY, outputPortSchemas); putListIfNotNull(result, FUNNELS_KEY, funnels); putListIfNotNull(result, CONNECTIONS_KEY, connections); putListIfNotNull(result, REMOTE_PROCESS_GROUPS_KEY, remoteProcessGroups); return result; } ProcessGroupSchema(Map map, String wrapperName); Map<String, Object> toMap(); List<ProcessorSchema> getProcessors(); List<ControllerServiceSchema> getControllerServices(); List<FunnelSchema> getFunnels(); List<ConnectionSchema> getConnections(); List<RemoteProcessGroupSchema> getRemoteProcessGroups(); List<ProcessGroupSchema> getProcessGroupSchemas(); Set<String> getPortIds(); String getComment(); void setComment(String comment); @Override ProcessGroupSchema convert(); @Override int getVersion(); List<PortSchema> getOutputPortSchemas(); List<PortSchema> getInputPortSchemas(); static final String PROCESS_GROUPS_KEY; static final String ID_DEFAULT; }
@Test public void testInputPortsRootGroup() { Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.INPUT_PORTS_KEY, Arrays.asList(createPortSchema("testId", "testName", ConfigSchema.TOP_LEVEL_NAME).toMap())); validateIssuesNumMatches(1, new ProcessGroupSchema(map, ConfigSchema.TOP_LEVEL_NAME)); }
@Test public void testOutputPortsRootGroup() { Map<String, Object> map = new HashMap<>(); map.put(CommonPropertyKeys.OUTPUT_PORTS_KEY, Arrays.asList(createPortSchema("testId", "testName", ConfigSchema.TOP_LEVEL_NAME).toMap())); validateIssuesNumMatches(1, new ProcessGroupSchema(map, ConfigSchema.TOP_LEVEL_NAME)); }