Skip to content

Commit 35ae77b

Browse files
committed
#558 added more tests
1 parent 02cf123 commit 35ae77b

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

quick-start/src/test/java/com/marklogic/quickstart/service/EntityManagerServiceTest.java

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.marklogic.hub.util.FileUtil;
1010
import com.marklogic.quickstart.auth.ConnectionAuthenticationToken;
1111
import com.marklogic.quickstart.model.EnvironmentConfig;
12+
import com.marklogic.quickstart.model.FlowModel;
1213
import com.marklogic.quickstart.model.entity_services.EntityModel;
1314
import org.apache.commons.io.FileUtils;
1415
import org.junit.*;
@@ -115,11 +116,45 @@ public void saveEntity() {
115116
}
116117

117118
@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);
119147
}
120148

149+
/**
150+
* Try getting a flow using the name of a valid flow, but requesting using the wrong type.
151+
* @throws IOException
152+
*/
121153
@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);
123158
}
124159

125160
}

0 commit comments

Comments
 (0)