|
9 | 9 | import com.marklogic.hub.util.FileUtil; |
10 | 10 | import com.marklogic.quickstart.auth.ConnectionAuthenticationToken; |
11 | 11 | import com.marklogic.quickstart.model.EnvironmentConfig; |
| 12 | +import com.marklogic.quickstart.model.FlowModel; |
12 | 13 | import com.marklogic.quickstart.model.entity_services.EntityModel; |
13 | 14 | import org.apache.commons.io.FileUtils; |
14 | 15 | import org.junit.*; |
@@ -115,11 +116,45 @@ public void saveEntity() { |
115 | 116 | } |
116 | 117 |
|
117 | 118 | @Test |
118 | | - public void getEntity() { |
| 119 | + public void getEntity() throws IOException { |
| 120 | + EntityModel entity = entityMgrService.getEntity(ENTITY); |
| 121 | + |
| 122 | + Assert.assertEquals(ENTITY, entity.getName()); |
| 123 | + Assert.assertEquals(4, entity.getInputFlows().size()); |
| 124 | + Assert.assertEquals(0, entity.getHarmonizeFlows().size()); |
| 125 | + } |
| 126 | + |
| 127 | + @Test public void getNoSuchEntity() throws IOException { |
| 128 | + EntityModel entity = entityMgrService.getEntity("no-such-entity"); |
| 129 | + |
| 130 | + Assert.assertNull(entity); |
| 131 | + } |
| 132 | + |
| 133 | + @Test |
| 134 | + public void getFlow() throws IOException { |
| 135 | + final String FLOW_NAME = "sjs-json-input-flow"; |
| 136 | + FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.INPUT, FLOW_NAME); |
| 137 | + Assert.assertEquals(ENTITY, flow.entityName); |
| 138 | + Assert.assertEquals(FLOW_NAME, flow.flowName); |
| 139 | + Assert.assertEquals(FlowType.INPUT, flow.flowType); |
| 140 | + } |
| 141 | + |
| 142 | + @Test |
| 143 | + public void getNoSuchFlow() throws IOException { |
| 144 | + final String FLOW_NAME = "no-such-flow"; |
| 145 | + FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.INPUT, FLOW_NAME); |
| 146 | + Assert.assertNull(flow); |
119 | 147 | } |
120 | 148 |
|
| 149 | + /** |
| 150 | + * Try getting a flow using the name of a valid flow, but requesting using the wrong type. |
| 151 | + * @throws IOException |
| 152 | + */ |
121 | 153 | @Test |
122 | | - public void getFlow() { |
| 154 | + public void getFlowByWrongType() throws IOException { |
| 155 | + final String FLOW_NAME = "sjs-json-input-flow"; |
| 156 | + FlowModel flow = entityMgrService.getFlow(ENTITY, FlowType.HARMONIZE, FLOW_NAME); |
| 157 | + Assert.assertNull(flow); |
123 | 158 | } |
124 | 159 |
|
125 | 160 | } |
0 commit comments