aboutsummaryrefslogtreecommitdiffstats
path: root/client/client-editor/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-09-10 17:05:36 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-09-10 17:07:47 +0100
commitd100854291559df1426ea1e64351872ae2d3867b (patch)
tree78baab90111307cd3d2460b2cca37e93a20ac9a3 /client/client-editor/src/test
parent8f82d7adcb53b349e14d3b356bda03588a554f95 (diff)
Checkstyle changes for apex model
Fix checkstyle warnings in the apex mode and knock on changes. Issue-ID: POLICY-1034 Change-Id: I10537e4288e9cad5ef18165ed2cdc1d3ab3139c1 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'client/client-editor/src/test')
-rw-r--r--client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java16
-rw-r--r--client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java970
2 files changed, 493 insertions, 493 deletions
diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
index 012167b51..dc1e1137b 100644
--- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
+++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java
@@ -43,7 +43,7 @@ import org.onap.policy.apex.client.editor.rest.ApexEditorMain.EditorState;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader;
import org.onap.policy.apex.model.basicmodel.handling.ApexModelStringWriter;
-import org.onap.policy.apex.model.modelapi.ApexAPIResult;
+import org.onap.policy.apex.model.modelapi.ApexApiResult;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicy;
import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -148,8 +148,8 @@ public class RestInterfaceTest {
* @return the session ID
*/
private static int createNewSession() {
- final ApexAPIResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(responseMsg.getResult(), ApexAPIResult.RESULT.SUCCESS);
+ final ApexApiResult responseMsg = target.path("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(responseMsg.getResult(), ApexApiResult.Result.SUCCESS);
assertTrue(responseMsg.getMessages().size() == 1);
return Integer.parseInt(responseMsg.getMessages().get(0));
}
@@ -162,8 +162,8 @@ public class RestInterfaceTest {
*/
private void uploadPolicy(final int sessionID, final String modelAsJsonString) {
final Builder requestbuilder = target.path("editor/" + sessionID + "/Model/Load").request();
- final ApexAPIResult responseMsg = requestbuilder.put(Entity.json(modelAsJsonString), ApexAPIResult.class);
- assertTrue(responseMsg.isOK());
+ final ApexApiResult responseMsg = requestbuilder.put(Entity.json(modelAsJsonString), ApexApiResult.class);
+ assertTrue(responseMsg.isOk());
}
/**
@@ -180,9 +180,9 @@ public class RestInterfaceTest {
uploadPolicy(sessionID, localmodelString);
- final ApexAPIResult responseMsg = target.path("editor/" + sessionID + "/Policy/Get")
- .queryParam("name", "Policy0").queryParam("version", "0.0.1").request().get(ApexAPIResult.class);
- assertTrue(responseMsg.isOK());
+ final ApexApiResult responseMsg = target.path("editor/" + sessionID + "/Policy/Get")
+ .queryParam("name", "Policy0").queryParam("version", "0.0.1").request().get(ApexApiResult.class);
+ assertTrue(responseMsg.isOk());
// The string in responseMsg.Messages[0] is a JSON representation of a AxPolicy object. Lets parse it
final String returnedPolicyAsString = responseMsg.getMessages().get(0);
diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java
index 1fb3a0a00..4d45289b1 100644
--- a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java
+++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java
@@ -32,8 +32,8 @@ import javax.ws.rs.core.MediaType;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Test;
-import org.onap.policy.apex.model.modelapi.ApexAPIResult;
-import org.onap.policy.apex.model.modelapi.ApexAPIResult.RESULT;
+import org.onap.policy.apex.model.modelapi.ApexApiResult;
+import org.onap.policy.apex.model.modelapi.ApexApiResult.Result;
import org.onap.policy.apex.model.utilities.TextFileUtils;
/**
@@ -48,202 +48,202 @@ public class TestApexEditorRestResource extends JerseyTest {
@Test
public void testSessionCreate() {
- ApexAPIResult result = target("editor/-2/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ ApexApiResult result = target("editor/-2/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
- result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
- result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
try {
- target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Model/Analyse").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/Analyse").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
- result = target("editor/-12345/Model/Analyse").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/Model/Analyse").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Analyse").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/Analyse").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/Model/Analyse").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/-12345/Model/Validate").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/Model/Validate").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/-12345/Model/Validate").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/Model/Validate").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
final String modelString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002699\","
+ "\"description\" : \"A description of the model\"" + "}";
final Entity<String> csEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Model/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/-12345/Model/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Model/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/-12345/Model/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Model/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Model/Create").request().post(csEntity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/-12345/Model/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/-12345/Model/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Model/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/-12345/Model/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Model/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Model/Update").request().put(csEntity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
try {
- result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexAPIResult.class);
+ result = target("editor/" + corruptSessionId + "/Model/GetKey").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/GetKey").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
- result = target("editor/-12345/Model/GetKey").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/Model/GetKey").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/GetKey").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/GetKey").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/Model/GetKey").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
try {
- result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexAPIResult.class);
+ result = target("editor/" + corruptSessionId + "/Model/Get").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
- result = target("editor/-12345/Model/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/Model/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/Model/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
try {
- result = target("editor/" + corruptSessionId + "/Model/Download").request().get(ApexAPIResult.class);
+ result = target("editor/" + corruptSessionId + "/Model/Download").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/Download").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Download").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
try {
- target("editor/-12345/Model/Download").request().get(ApexAPIResult.class);
+ target("editor/-12345/Model/Download").request().get(ApexApiResult.class);
fail("test should throw an exception here");
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
try {
- target("editor/12345/Model/Download").request().get(ApexAPIResult.class);
+ target("editor/12345/Model/Download").request().get(ApexApiResult.class);
fail("test should throw an exception here");
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
try {
- result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexAPIResult.class);
+ result = target("editor/" + corruptSessionId + "/KeyInformation/Get").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/KeyInformation/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
- result = target("editor/-12345/KeyInformation/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/KeyInformation/Get").request().get(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/KeyInformation/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
+ result = target("editor/-12345/KeyInformation/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/KeyInformation/Get").request().get(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
try {
- result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexAPIResult.class);
+ result = target("editor/" + corruptSessionId + "/Model/Delete").request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Model/Delete").request().delete(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
- result = target("editor/-12345/Model/Delete").request().delete(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
- result = target("editor/12345/Model/Delete").request().delete(ApexAPIResult.class);
- assertEquals(RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Delete").request().delete(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
+ result = target("editor/-12345/Model/Delete").request().delete(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
+ result = target("editor/12345/Model/Delete").request().delete(ApexApiResult.class);
+ assertEquals(Result.FAILED, result.getResult());
}
@Test
public void testContextSchema() throws IOException {
- ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
- result = target("editor/-12345/Validate/ContextSchema").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/-12345/Validate/ContextSchema").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Validate/ContextSchema").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Validate/ContextSchema").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", "%%%$£")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json");
Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON);
- result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity("", MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -253,16 +253,16 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
Entity<String> csEntity = Entity.entity(csString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/ContextSchema/Create").request().post(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/ContextSchema/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/ContextSchema/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/ContextSchema/Create").request().post(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
target("editor/" + corruptSessionId + "/ContextSchema/Create").request().post(csEntity,
- ApexAPIResult.class);
+ ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -272,109 +272,109 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
csEntity = Entity.entity(csString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/ContextSchema/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/ContextSchema/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/ContextSchema/Update").request().put(csEntity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextSchema/Get").queryParam("name", "NonExistant")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/-123345/ContextSchema/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/ContextSchema/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/ContextSchema").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
target("editor/" + corruptSessionId + "/ContextSchema/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/-123345/ContextSchema/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/ContextSchema/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/ContextSchema/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextSchema/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
}
@Test
public void testContextAlbum() throws IOException {
- ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
- result = target("editor/-12345/Validate/ContextAlbum").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/-12345/Validate/ContextAlbum").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
- result = target("editor/" + sessionId + "/Validate/ContextAlbum").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Validate/ContextAlbum").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", "%%%$£")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json");
Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON);
- result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity("", MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
String caString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"scope\" : \"Domain\"," + "\"writeable\" : false,"
@@ -382,15 +382,15 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
Entity<String> caEntity = Entity.entity(caString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -401,127 +401,127 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
caEntity = Entity.entity(caString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/ContextAlbum/Update").request().put(caEntity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
try {
target("editor/" + corruptSessionId + "/ContextAlbum/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextAlbum/Get").queryParam("name", "IDontExist")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/-123345/ContextAlbum/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/ContextAlbum/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
target("editor/" + corruptSessionId + "/ContextAlbum/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/-123345/ContextAlbum/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/ContextAlbum/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/ContextAlbum/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/ContextAlbum/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
}
@Test
public void testEvent() throws IOException {
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
- ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
- result = target("editor/-12345/Validate/Event").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/-12345/Validate/Event").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Validate/Event").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Validate/Event").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Validate/Event").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", "%%%$£")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json");
Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON);
- result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity("", MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\","
+ "\"target\" : \"end\"," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult());
+ result = target("editor/-12345/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -532,8 +532,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\","
@@ -543,8 +543,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\","
@@ -552,8 +552,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\","
@@ -563,8 +563,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.someone.elses.rainbow\","
@@ -572,15 +572,15 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Event/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Event/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/Event/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Event/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -591,8 +591,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"NonExistantEvent\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.someone.elses.rainbow\","
@@ -600,122 +600,122 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Event/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Event/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Event/Get").queryParam("name", "IDontExist")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/-123345/Event/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Event/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Event/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/-12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Event/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/-123345/Event/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Event/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/Event/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Event/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
}
@Test
public void testTask() throws IOException {
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
- ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
- result = target("editor/-12345/Validate/Task").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/-12345/Validate/Task").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Validate/Task").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Validate/Task").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Validate/Task").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Validate/Task").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/Task").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Validate/Task").queryParam("name", "%%%$£")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json");
Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON);
- result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity("", MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult());
+ result = target("editor/-12345/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -724,8 +724,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\","
+ "\"inputFields\" : {\"IField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", "
@@ -733,16 +733,16 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi\"," + "\"version\" : \"0.0.2\","
+ "\"inputFields\" : {\"IField0\" : null},"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\","
+ "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", "
@@ -750,8 +750,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Howdy\"," + "\"version\" : \"0.0.2\","
+ "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", "
@@ -759,8 +759,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing2\"," + "\"version\" : \"0.0.2\","
+ "\"outputFields\" : {\"OField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", "
@@ -768,16 +768,16 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi2\"," + "\"version\" : \"0.0.2\","
+ "\"outputFields\" : {\"OField0\" : null},"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay2\"," + "\"version\" : \"0.0.2\","
+ "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\","
@@ -785,8 +785,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Howdy2\"," + "\"version\" : \"0.0.2\","
+ "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", "
@@ -794,23 +794,23 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing3\"," + "\"version\" : \"0.0.2\","
+ "\"taskLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons,"
+ " lots of lime\"}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi3\"," + "\"version\" : \"0.0.2\","
+ "\"taskLogic\" : null," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay3\"," + "\"version\" : \"0.0.2\","
+ "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\","
@@ -819,16 +819,16 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " lots of lime\"}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Howdy3\"," + "\"version\" : \"0.0.2\","
+ "\"taskLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : null},"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing4\"," + "\"version\" : \"0.0.2\","
+ "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"Par0\", "
@@ -836,16 +836,16 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi4\"," + "\"version\" : \"0.0.2\","
+ "\"parameters\" : {\"Par0\" : null},"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay4\"," + "\"version\" : \"0.0.2\","
+ "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"NotPar0\", \"defaultValue\" : "
@@ -853,61 +853,61 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Howdy4\"," + "\"version\" : \"0.0.2\","
+ "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"MyParameter\", \"defaultValue\" : null}},"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HowsItGoing5\"," + "\"version\" : \"0.0.2\","
+ "\"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}],"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hi5\"," + "\"version\" : \"0.0.2\","
+ "\"contexts\" : []," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"GoodDay5\"," + "\"version\" : \"0.0.2\","
+ "\"contexts\" : [{\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\"}],"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Howdy5\"," + "\"version\" : \"0.0.2\","
+ "\"contexts\" : [{\"name\" : null, \"version\" : \"0.0.1\"}],"
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002799\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Task/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Task/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/Task/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Task/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -916,116 +916,116 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"NonExistantEvent\"," + "\"version\" : \"0.0.2\","
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Task/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Task/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Task/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Task/Get").queryParam("name", "IDontExist")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/-123345/Task/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Task/Get").queryParam("name", (String) null).queryParam("version", (String) null)
- .request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Task/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/-12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Task/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/-123345/Task/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Task/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/Task/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Task/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
}
@Test
public void testPolicy() throws IOException {
final int corruptSessionId = ApexEditorRestResource.createCorruptSession();
- ApexAPIResult result = target("editor/-1/Session/Create").request().get(ApexAPIResult.class);
- assertEquals(RESULT.SUCCESS, result.getResult());
+ ApexApiResult result = target("editor/-1/Session/Create").request().get(ApexApiResult.class);
+ assertEquals(Result.SUCCESS, result.getResult());
final int sessionId = new Integer(result.getMessages().get(0));
- result = target("editor/-12345/Model/Validate").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/-12345/Model/Validate").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Validate").request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Model/Validate").request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", "%%%$£")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json");
Entity<String> modelEntity = Entity.entity("Somewhere over the rainbow", MediaType.APPLICATION_JSON);
- result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + -12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + 12345 + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity("", MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
modelEntity = Entity.entity(modelString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Model/Load").request().put(modelEntity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Event/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
String entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1040,17 +1040,17 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
Entity<String> entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_EXISTS, result.getResult());
+ result = target("editor/-12345/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -1060,8 +1060,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"states\" : null," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1076,8 +1076,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hello2\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1092,8 +1092,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello3\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1107,8 +1107,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello4\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1121,8 +1121,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello5\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1135,8 +1135,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello6\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1151,8 +1151,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Hello7\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1160,8 +1160,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello8\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1176,8 +1176,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Hello9\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1191,9 +1191,9 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
System.err.println(result);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello10\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1209,8 +1209,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Hello11\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1225,8 +1225,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello12\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1244,8 +1244,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hello13\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1263,8 +1263,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello14\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1284,8 +1284,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hello15\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1305,8 +1305,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
entityString = "{" + "\"name\" : \"Hello16\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1325,8 +1325,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello17\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1349,8 +1349,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ " }" + " }" + "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
entityString = "{" + "\"name\" : \"Hello18\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1371,8 +1371,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"Hello19\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1394,8 +1394,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "}," + "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Create").request().post(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1410,19 +1410,19 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A better description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/-12345/Policy/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/1234545/Policy/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
- result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ result = target("editor/-12345/Policy/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/1234545/Policy/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Policy/Update").queryParam("firstStatePeriodic", "true").request()
- .put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
try {
- target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class);
+ target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
@@ -1440,8 +1440,8 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A better description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
entityString = "{" + "\"name\" : \"IDontExist\"," + "\"version\" : \"0.0.2\","
+ "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\","
@@ -1456,60 +1456,60 @@ public class TestApexEditorRestResource extends JerseyTest {
+ "\"uuid\" : \"1fa2e430-f2b2-11e6-bc64-92361f002671\","
+ "\"description\" : \"A better description of hello\"" + "}";
entity = Entity.entity(entityString, MediaType.APPLICATION_JSON);
- result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ result = target("editor/" + sessionId + "/Policy/Update").request().put(entity, ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", "IDontExist")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/-123345/Policy/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Policy/Get").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Policy/Get").queryParam("name", "Hello")
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/-12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/12345/Validate/Event").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().get(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().get(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
try {
target("editor/" + corruptSessionId + "/Policy/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
} catch (final Exception e) {
assertEquals("HTTP 500 Request failed.", e.getMessage());
}
result = target("editor/-123345/Policy/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/123345/Policy/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.FAILED, result.getResult());
result = target("editor/" + sessionId + "/Policy/Delete").queryParam("name", "Hello")
- .queryParam("version", "0.0.2").request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", "0.0.2").request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
result = target("editor/" + sessionId + "/Policy/Delete").queryParam("name", (String) null)
- .queryParam("version", (String) null).request().delete(ApexAPIResult.class);
- assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult());
+ .queryParam("version", (String) null).request().delete(ApexApiResult.class);
+ assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
}
}