EntityManagerService { public FlowModel getFlow(String entityName, FlowType flowType, String flowName) throws IOException { EntityModel entity = getEntity(entityName); List<FlowModel> flows; if (flowType.equals(FlowType.INPUT)) { flows = entity.inputFlows; } else { flows = entity.harmonizeFlows; } for (FlowModel flow : flows) { if (flow.flowName != null && flow.flowName.equals(flowName)) { return flow; } } throw new DataHubProjectException("Flow not found: " + entityName + " / " + flowName); }  List<EntityModel> getLegacyEntities(); List<EntityModel> getEntities(); EntityModel createEntity(EntityModel newEntity); EntityModel saveEntity(EntityModel entity); void deleteEntity(String entity); void deploySearchOptions(); void saveDbIndexes(); void savePii(); void saveAllUiData(List<EntityModel> entities); void saveEntityUiData(EntityModel entity); EntityModel getEntity(String entityName); EntityModel getEntity(String entityName, Boolean extendSubEntities); FlowModel getFlow(String entityName, FlowType flowType, String flowName); FlowModel createFlow(String entityName, FlowType flowType, FlowModel newFlow); void deleteFlow(String entityName, String flowName, FlowType flowType); JsonNode validatePlugin(
        HubConfig config,
        String entityName,
        String flowName,
        PluginModel plugin
    ); void saveFlowPlugin(
        PluginModel plugin
    ); static final String ENTITY_FILE_EXTENSION; }
@Test public void getFlow() throws IOException { final String FLOW_NAME = "sjs-json-input-flow"; FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.INPUT, FLOW_NAME); assertEquals(ENTITY, flow.entityName); assertEquals(FLOW_NAME, flow.flowName); assertEquals(FlowType.INPUT, flow.flowType); }
@Test public void getNoSuchFlow() throws IOException { Assertions.assertThrows(DataHubProjectException.class, () -> { final String FLOW_NAME = "no-such-flow"; FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.INPUT, FLOW_NAME); fail("No such flow should throw an error"); }); }
@Test public void getFlowByWrongType() throws IOException { Assertions.assertThrows(DataHubProjectException.class, () -> { final String FLOW_NAME = "sjs-json-input-flow"; FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.HARMONIZE, FLOW_NAME); fail("Flow by wrong type should throw an exception"); }); }