diff options
author | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-13 12:32:32 +0100 |
---|---|---|
committer | ramverma <ram.krishna.verma@ericsson.com> | 2018-07-13 16:07:05 +0100 |
commit | 08b595c863b45e759e57ef419c83dad2b209df9c (patch) | |
tree | 02f9c3e7c74e5b1242d4a04c21ade4e4ea501063 /client/client-editor/src/test | |
parent | 7fbb46185166f2699b624cd2616c6fdd74ef4832 (diff) |
Adding client editor module to apex-pdp
The size of the review is big because of following:
1. edit_area & jquery are 3PP's used in the client editor
2. ui elements like svg, gifs, png
Change-Id: Ib62d8e6dda6e6dc1b6e604298e23505523f77cf2
Issue-ID: POLICY-864
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'client/client-editor/src/test')
8 files changed, 9402 insertions, 0 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 new file mode 100644 index 000000000..eeefa4b95 --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/RestInterfaceTest.java @@ -0,0 +1,212 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.client.WebTarget; +import javax.xml.bind.JAXBException; + +import org.eclipse.persistence.jpa.jpql.Assert; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +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.policymodel.concepts.AxPolicy; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.apex.model.utilities.ResourceUtils; + +/** + * The RestInterface Test. + */ +public class RestInterfaceTest { + // CHECKSTYLE:OFF: MagicNumber + + private static final String TESTMODELFILE = "models/SamplePolicyModelMVEL.json"; + private static final String TESTPORTNUM = "18989"; + private static final long MAX_WAIT = 15000; // 15 sec + private static final InputStream SYSIN = System.in; + private static final String[] EDITOR_MAIN_ARGS = new String[] { "-p", TESTPORTNUM }; + + private static ApexEditorMain editorMain; + private static WebTarget target; + + private static AxPolicyModel localmodel = null; + private static String localmodelString = null; + + /** + * Sets up the tests. + * + * @throws Exception if an error happens + */ + @BeforeClass + public static void setUp() throws Exception { + // Start the editor + editorMain = new ApexEditorMain(EDITOR_MAIN_ARGS, System.out); + // prevent a stray stdin value from killing the editor + final ByteArrayInputStream input = new ByteArrayInputStream("".getBytes()); + System.setIn(input); + // Init the editor in a separate thread + final Runnable testThread = new Runnable() { + @Override + public void run() { + editorMain.init(); + } + }; + new Thread(testThread).start(); + // wait until editorMain is in state RUNNING + final long startwait = System.currentTimeMillis(); + while (editorMain.getState().equals(EditorState.STOPPED) || editorMain.getState().equals(EditorState.READY) + || editorMain.getState().equals(EditorState.INITIALIZING)) { + if (editorMain.getState().equals(EditorState.STOPPED)) { + Assert.fail("Rest endpoint (" + editorMain + ") shut down before it could be used"); + } + if (System.currentTimeMillis() - startwait > MAX_WAIT) { + Assert.fail("Rest endpoint (" + editorMain + ") for test failed to start fast enough"); + } + Thread.sleep(100); + } + + // create the client + final Client c = ClientBuilder.newClient(); + // Create the web target + target = c.target(new ApexEditorParameters().getBaseURI()); + + // load a test model locally + localmodel = new ApexModelReader<>(AxPolicyModel.class, false) + .read(ResourceUtils.getResourceAsStream(TESTMODELFILE)); + localmodelString = + new ApexModelStringWriter<AxPolicyModel>(false).writeJSONString(localmodel, AxPolicyModel.class); + + // initialize a session ID + createNewSession(); + } + + /** + * Clean up streams. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException the interrupted exception + */ + @AfterClass + public static void cleanUpStreams() throws IOException, InterruptedException { + editorMain.shutdown(); + // wait until editorMain is in state STOPPED + final long startwait = System.currentTimeMillis(); + while (!editorMain.getState().equals(EditorState.STOPPED)) { + if (System.currentTimeMillis() - startwait > MAX_WAIT) { + Assert.fail("Rest endpoint (" + editorMain + ") for test failed to shutdown fast enough"); + } + Thread.sleep(50); + } + System.setIn(SYSIN); + } + + /** + * Test to see that the message create Model with model id -1 . + */ + @Test + public void createSession() { + createNewSession(); + } + + /** + * Creates a new session. + * + * @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); + assertTrue(responseMsg.getMessages().size() == 1); + return Integer.parseInt(responseMsg.getMessages().get(0)); + } + + /** + * Upload policy. + * + * @param sessionID the session ID + * @param modelAsJsonString the model as json string + */ + 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()); + } + + /** + * Create a new session, Upload a test policy model, then get a policy, parse it, and compare it to the same policy + * in the original model. + * + * @throws ApexException if there is an Apex Error + * @throws JAXBException if there is a JaxB Error + **/ + @Test + public void testUploadThenGet() throws ApexException, JAXBException { + + final int sessionID = createNewSession(); + + 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()); + + // The string in responseMsg.Messages[0] is a JSON representation of a AxPolicy object. Lets parse it + final String returnedPolicyAsString = responseMsg.getMessages().get(0); + ApexModelReader<AxPolicy> apexPolicyReader = new ApexModelReader<>(AxPolicy.class, false); + final AxPolicy returnedpolicy = apexPolicyReader.read(returnedPolicyAsString); + // AxPolicy returnedpolicy = RestUtils.getConceptFromJSON(returnedPolicyAsString, AxPolicy.class); + + // Extract the local copy of that policy from the local Apex Policy Model + final AxPolicy localpolicy = localmodel.getPolicies().get("Policy0", "0.0.1"); + + // Write that local copy of the AxPolicy object to a Json String, ten parse it again + final ApexModelStringWriter<AxPolicy> apexModelWriter = new ApexModelStringWriter<>(false); + final String localPolicyString = apexModelWriter.writeJSONString(localpolicy, AxPolicy.class); + apexPolicyReader = new ApexModelReader<>(AxPolicy.class, false); + final AxPolicy localpolicyReparsed = apexPolicyReader.read(localPolicyString); + // AxPolicy localpolicy_reparsed = RestUtils.getConceptFromJSON(returnedPolicyAsString, AxPolicy.class); + + assertNotNull(returnedpolicy); + assertNotNull(localpolicy); + assertNotNull(localpolicyReparsed); + assertEquals(localpolicy, localpolicyReparsed); + assertEquals(localpolicy, returnedpolicy); + } + + // TODO Full unit testing of REST interface + +} 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 new file mode 100644 index 000000000..ee156e02b --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorRestResource.java @@ -0,0 +1,1497 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; + +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Application; +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.utilities.TextFileUtils; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestApexEditorRestResource extends JerseyTest { + @Override + protected Application configure() { + return new ResourceConfig(ApexEditorRestResource.class); + } + + @Test + public void testSessionCreate() { + 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()); + final int sessionId = new Integer(result.getMessages().get(0)); + + 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); + } 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()); + + try { + 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()); + + 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()); + + try { + 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()); + + try { + 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); + } 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()); + + try { + 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()); + + try { + 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()); + try { + 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); + 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); + } 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()); + + try { + 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()); + } + + @Test + public void testContextSchema() throws IOException { + 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()); + + try { + 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").queryParam("name", (String) null) + .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()); + + 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()); + modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); + 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 + "/ContextSchema/Get").queryParam("name", (String) null) + .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); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + String csString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + + "\"schemaFlavour\" : \"Java\"," + "\"schemaDefinition\" : \"java.lang.String\"," + + "\"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()); + + try { + target("editor/" + corruptSessionId + "/ContextSchema/Create").request().post(csEntity, + ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + csString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + + "\"schemaFlavour\" : \"Java\"," + "\"schemaDefinition\" : \"my.perfect.String\"," + + "\"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()); + + try { + 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()); + 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()); + result = target("editor/-123345/ContextSchema/Get").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/ContextSchema/Get").queryParam("name", "Hello") + .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()); + + try { + target("editor/" + corruptSessionId + "/ContextSchema/Delete").queryParam("name", "Hello") + .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()); + result = target("editor/123345/ContextSchema/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/" + sessionId + "/ContextSchema/Delete").queryParam("name", (String) null) + .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()); + 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()); + + try { + 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").queryParam("name", (String) null) + .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()); + + 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()); + modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); + 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 + "/ContextAlbum/Get").queryParam("name", (String) null) + .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," + + "\"itemSchema\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\"}," + + "\"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()); + + try { + target("editor/" + corruptSessionId + "/ContextAlbum/Create").request().post(caEntity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + caString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + + "\"scope\" : \"Global\"," + "\"writeable\" : false," + + "\"itemSchema\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\"}," + + "\"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()); + + try { + 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); + } 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()); + 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()); + result = target("editor/-123345/ContextAlbum/Get").queryParam("name", (String) null) + .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()); + + result = target("editor/" + sessionId + "/Validate/ContextAlbum").queryParam("name", (String) null) + .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); + } 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()); + result = target("editor/123345/ContextAlbum/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/" + sessionId + "/ContextAlbum/Delete").queryParam("name", (String) null) + .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()); + 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/" + sessionId + "/Validate/Event").request().get(ApexAPIResult.class); + assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + + try { + 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()); + + result = target("editor/" + sessionId + "/Validate/Event").queryParam("name", "%%%$£") + .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()); + modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); + 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 + "/Event/Get").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Event/Create").request().post(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : \"Hiya\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + + "\"target\" : \"end\"," + "\"parameters\" : {}," + + "\"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()); + + entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + + "\"target\" : \"end\"," + + "\"parameters\" : {\"Par0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"Par0\", \"optional\" : false}}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hi\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + + "\"target\" : \"end\"," + "\"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 + "/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\"," + + "\"target\" : \"end\"," + + "\"parameters\" : {\"Par0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"Par0\", \"optional\" : false}}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," + + "\"source\" : \"start\"," + "\"target\" : \"finish\"," + + "\"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()); + + try { + target("editor/" + corruptSessionId + "/Event/Update").request().put(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : null," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," + + "\"source\" : \"start\"," + "\"target\" : \"finish\"," + + "\"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()); + + entityString = "{" + "\"name\" : \"NonExistantEvent\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.someone.elses.rainbow\"," + + "\"source\" : \"start\"," + "\"target\" : \"finish\"," + + "\"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/Get").queryParam("name", "Hello") + .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()); + result = target("editor/-123345/Event/Get").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Event/Get").queryParam("name", "Hello") + .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()); + result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Event/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/123345/Event/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/" + sessionId + "/Event/Delete").queryParam("name", (String) null) + .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()); + 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/" + sessionId + "/Validate/Task").request().get(ApexAPIResult.class); + assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + + try { + 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()); + + result = target("editor/" + sessionId + "/Validate/Task").queryParam("name", "%%%$£") + .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()); + modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); + 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 + "/Event/Get").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Task/Create").request().post(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : \"Hiya\"," + "\"version\" : \"0.0.2\"," + + "\"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()); + + entityString = "{" + "\"name\" : \"HowsItGoing\"," + "\"version\" : \"0.0.2\"," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"IField0\", \"optional\" : false}}," + + "\"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()); + + 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()); + + entityString = "{" + "\"name\" : \"GoodDay\"," + "\"version\" : \"0.0.2\"," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"IField0\", \"optional\" : false}}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Howdy\"," + "\"version\" : \"0.0.2\"," + + "\"inputFields\" : {\"IField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"NotIField0\", \"optional\" : false}}," + + "\"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()); + + entityString = "{" + "\"name\" : \"HowsItGoing2\"," + "\"version\" : \"0.0.2\"," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"StringType\", \"version\" : \"0.0.1\", \"localName\" : \"OField0\", \"optional\" : false}}," + + "\"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()); + + 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()); + + entityString = "{" + "\"name\" : \"GoodDay2\"," + "\"version\" : \"0.0.2\"," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"OField0\", \"optional\" : false}}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Howdy2\"," + "\"version\" : \"0.0.2\"," + + "\"outputFields\" : {\"OField0\" : {\"name\" : \"NonExistantType\", \"version\" : \"0.0.1\", \"localName\" : \"NotOField0\", \"optional\" : false}}," + + "\"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()); + + 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()); + + 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()); + + entityString = "{" + "\"name\" : \"GoodDay3\"," + "\"version\" : \"0.0.2\"," + + "\"namespace\" : \"somewhere.over.the.rainbow\"," + "\"source\" : \"beginning\"," + + "\"target\" : \"end\"," + + "\"taskLogic\" : {\"logicFlavour\" : \"UNDEFINED\", \"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()); + + 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()); + + entityString = "{" + "\"name\" : \"HowsItGoing4\"," + "\"version\" : \"0.0.2\"," + + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"Par0\", \"defaultValue\" : \"Parameter Defaultvalue\"}}," + + "\"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()); + + 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()); + + entityString = "{" + "\"name\" : \"GoodDay4\"," + "\"version\" : \"0.0.2\"," + + "\"parameters\" : {\"Par0\" : {\"parameterName\" : \"NotPar0\", \"defaultValue\" : \"Parameter Defaultvalue\"}}," + + "\"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()); + + 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()); + + 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()); + + 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()); + + 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()); + + 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()); + + 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()); + + try { + target("editor/" + corruptSessionId + "/Task/Update").request().put(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : null," + "\"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.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/Get").queryParam("name", "Hello") + .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()); + 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()); + result = target("editor/-123345/Task/Get").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Task/Get").queryParam("name", "Hello") + .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()); + result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Task/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/123345/Task/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/" + sessionId + "/Task/Delete").queryParam("name", (String) null) + .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()); + 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/" + sessionId + "/Model/Validate").request().get(ApexAPIResult.class); + assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + + try { + 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()); + + result = target("editor/" + sessionId + "/Model/Validate").queryParam("name", "%%%$£") + .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()); + modelEntity = Entity.entity("", MediaType.APPLICATION_JSON); + 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 + "/Event/Get").queryParam("name", (String) null) + .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\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + try { + target("editor/" + corruptSessionId + "/Policy/Create").request().post(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : \"GoodTaSeeYa\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"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()); + + entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello2\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : null," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello3\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : null," + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello4\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"stateOutputs\" : null," + " \"tasks\" : {" + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello5\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : 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()); + + entityString = "{" + "\"name\" : \"Hello6\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"IDontExist\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello7\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : 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()); + + entityString = "{" + "\"name\" : \"Hello8\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"IDontExist\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello9\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + " \"event\" : null," + " \"nextState\" : null" + " }" + + " }," + " \"tasks\" : {" + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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); + System.err.println(result); + assertEquals(ApexAPIResult.RESULT.FAILED, result.getResult()); + + entityString = "{" + "\"name\" : \"Hello10\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"IDontExist\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello11\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : null," + " \"outputType\" : \"DIRECT\"," + + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"Hello12\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello13\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : null}," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello14\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello15\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [{\"name\" : \"IDontExist\", \"version\" : \"0.0.1\"}]," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello16\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [null]," + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello17\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }," + + " \"finalizers\" : {" + + " \"sf0\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}" + + " }" + " }" + "}," + "\"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()); + + entityString = "{" + "\"name\" : \"Hello18\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }," + + " \"finalizers\" : {" + " \"sf0\" : 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()); + + entityString = "{" + "\"name\" : \"Hello19\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"taskSelectionLogic\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : \"lots of lemons, lots of lime\"}," + + " \"contexts\" : [{\"name\" : \"contextAlbum0\", \"version\" : \"0.0.1\"}]," + + " \"stateOutputs\" : {" + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }," + + " \"finalizers\" : {" + + " \"sf0\" : {\"logicFlavour\" : \"LemonAndLime\", \"logic\" : 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()); + + entityString = "{" + "\"name\" : \"HelloAnother\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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/" + sessionId + "/Policy/Update").queryParam("firstStatePeriodic", "true").request() + .put(entity, ApexAPIResult.class); + assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + + try { + target("editor/" + corruptSessionId + "/Policy/Update").request().put(entity, ApexAPIResult.class); + } catch (final Exception e) { + assertEquals("HTTP 500 Request failed.", e.getMessage()); + } + + entityString = "{" + "\"name\" : null," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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()); + + entityString = "{" + "\"name\" : \"IDontExist\"," + "\"version\" : \"0.0.2\"," + + "\"template\" : \"somewhere.over.the.rainbow\"," + "\"firstState\" : \"state\"," + + "\"states\" : {" + " \"state\" : {" + " \"name\" : \"state\"," + + " \"trigger\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"defaultTask\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + " \"stateOutputs\" : {" + + " \"so0\" : {" + + " \"event\" : {\"name\" : \"inEvent\", \"version\" : \"0.0.1\"}," + + " \"nextState\" : null" + " }" + " }," + " \"tasks\" : {" + + " \"tr0\" : {" + " \"task\" : {\"name\" : \"task\", \"version\" : \"0.0.1\"}," + + " \"outputType\" : \"DIRECT\"," + " \"outputName\" : \"so0\"" + " }" + " }" + " }" + "}," + + "\"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/Get").queryParam("name", "Hello") + .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()); + result = target("editor/" + sessionId + "/Policy/Get").queryParam("name", (String) null) + .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()); + result = target("editor/123345/Policy/Get").queryParam("name", (String) null) + .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); + } 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()); + result = target("editor/-12345/Validate/Event").queryParam("name", (String) null) + .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()); + + try { + target("editor/" + corruptSessionId + "/Policy/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/123345/Policy/Delete").queryParam("name", (String) null) + .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()); + result = target("editor/" + sessionId + "/Policy/Delete").queryParam("name", (String) null) + .queryParam("version", (String) null).request().delete(ApexAPIResult.class); + assertEquals(ApexAPIResult.RESULT.SUCCESS, result.getResult()); + } +} diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java new file mode 100644 index 000000000..0ae54e5af --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestApexEditorStartup.java @@ -0,0 +1,441 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; + +import org.junit.Test; +import org.onap.policy.apex.client.editor.rest.ApexEditorMain.EditorState; + +/** + * The Class TestApexEditorStartup. + */ +public class TestApexEditorStartup { + // CHECKSTYLE:OFF: MagicNumber + + /** + * Test no args. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testNoArgs() throws IOException, InterruptedException { + final String[] args = new String[] {}; + + final String outString = runEditor(args); + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=-1sec], " + + "State=READY) starting at http://0.0.0.0:18989/apexservices/")); + assertTrue(outString.contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=-1sec], " + + "State=RUNNING) started at http://0.0.0.0:18989/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + } + + /** + * Test bad arg 0. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadArg0() throws IOException, InterruptedException { + final String[] args = new String[] { "12321" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[null], State=STOPPED) parameter error, too many command line arguments specified : [12321]")); + } + } + + /** + * Test bad arg 1. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadArg1() throws IOException, InterruptedException { + final String[] args = new String[] { "12321 12322 12323" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[null], State=STOPPED) parameter error, too many command line arguments specified : [12321 12322 12323]")); + } + } + + /** + * Test bad arg 2. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadArg2() throws IOException, InterruptedException { + final String[] args = new String[] { "-z" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[null], State=STOPPED) parameter error, invalid command line arguments specified : Unrecognized option: -z")); + } + } + + /** + * Test bad arg 3. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadArg3() throws IOException, InterruptedException { + final String[] args = new String[] { "--hello" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getLocalizedMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[null], State=STOPPED) parameter error, invalid command line arguments specified : Unrecognized option: --hello")); + } + } + + + /** + * Test bad arg 4. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadArg4() throws IOException, InterruptedException { + final String[] args = new String[] { "-l", "+++++" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getLocalizedMessage() + .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://+++++:18989/apexservices/, TTL=-1sec], " + + "State=STOPPED) parameters invalid, listen address is not valid. " + + "Illegal character in hostname at index 7: http://+++++:18989/apexservices/")); + } + } + + /** + * Test help 0. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testHelp0() throws IOException, InterruptedException { + final String[] args = new String[] { "--help" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage() + .startsWith("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]")); + } + } + + /** + * Test help 1. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testHelp1() throws IOException, InterruptedException { + final String[] args = new String[] { "-h" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage() + .startsWith("usage: org.onap.policy.apex.client.editor.rest.ApexEditorMain [options...]")); + } + } + + /** + * Test port arg. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testPortArgShJo() throws IOException, InterruptedException { + final String[] args = new String[] { "-p12321" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], " + + "State=READY) starting at http://0.0.0.0:12321/apexservices/")); + assertTrue(outString.contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], " + + "State=RUNNING) started at http://0.0.0.0:12321/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + } + + /** + * Test port arg. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testPortArgShSe() throws IOException, InterruptedException { + final String[] args = new String[] { "-p", "12321" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], " + + "State=READY) starting at http://0.0.0.0:12321/apexservices/")); + assertTrue(outString.contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], " + + "State=RUNNING) started at http://0.0.0.0:12321/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("(ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=-1sec], State=STOPPED) shut down ")); + } + + + /** + * Test port arg. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testPortArgSpace() throws IOException, InterruptedException { + final String[] args = new String[] { "-p 12321" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage().startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[null], State=STOPPED) parameter error, error parsing argument \"port\" :For input string: \" 12321\"")); + } + } + + /** + * Test bad port arg 0. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadPortArgs0() throws IOException, InterruptedException { + final String[] args = new String[] { "-p0" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage() + .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:0/apexservices/, TTL=-1sec], " + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); + } + } + + /** + * Test bad port arg 1023. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadPortArgs1023() throws IOException, InterruptedException { + final String[] args = new String[] { "-p1023" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage() + .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:1023/apexservices/, TTL=-1sec], " + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); + } + } + + /** + * Test bad port arg 65536. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testBadPortArgs65536() throws IOException, InterruptedException { + final String[] args = new String[] { "-p65536" }; + + try { + runEditor(args); + fail("test should throw an exception here"); + } catch (final Exception e) { + assertTrue(e.getMessage() + .startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:65536/apexservices/, TTL=-1sec], " + + "State=STOPPED) parameters invalid, port must be between 1024 and 65535")); + } + } + + /** + * Test TTL arg 0. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testTTLArg0() throws IOException, InterruptedException { + final String[] args = new String[] { "-t10" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=10sec], " + + "State=READY) starting at http://0.0.0.0:18989/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=10sec], State=RUNNING) started")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:18989/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + } + + /** + * Test TTL arg 10. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testTTLArg1() throws IOException, InterruptedException { + final String[] args = new String[] { "-t", "10", "-l", "localhost" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], " + + "State=READY) starting at http://localhost:18989/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=RUNNING) started")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://localhost:18989/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + } + + /** + * Test port TTL arg 0. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testPortTTLArg0() throws IOException, InterruptedException { + final String[] args = new String[] { "-t", "10", "-p", "12321" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=10sec], " + + "State=READY) starting at http://0.0.0.0:12321/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=10sec], State=RUNNING) started")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://0.0.0.0:12321/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + } + + + /** + * Test port TTL arg 10. + * + * @throws IOException Signals that an I/O exception has occurred. + * @throws InterruptedException if the test is interrupted + */ + @Test + public void testPortTTLArg1() throws IOException, InterruptedException { + final String[] args = new String[] { "--time-to-live", "10", "--port", "12321", "--listen", "127.0.0.1" }; + + final String outString = runEditor(args); + + assertTrue(outString.startsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], " + + "State=READY) starting at http://127.0.0.1:12321/apexservices/")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").contains("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=RUNNING) started")); + assertTrue(outString.replaceAll("[\\r?\\n]+", " ").endsWith("Apex Editor REST endpoint (ApexEditorMain: " + + "Config=[ApexEditorParameters: URI=http://127.0.0.1:12321/apexservices/, TTL=10sec], State=STOPPED) shut down ")); + } + + /** + * Run the editor for tests. + * + * @param args the args + * @return the output string + * @throws InterruptedException if the test is interrupted + */ + private String runEditor(final String[] args) throws InterruptedException { + final ByteArrayOutputStream outBAStream = new ByteArrayOutputStream(); + final PrintStream outStream = new PrintStream(outBAStream); + + final ApexEditorMain editorMain = new ApexEditorMain(args, outStream); + + // This test must be started in a thread because we want to intercept the output in cases where the editor is + // started infinitely + final Runnable testThread = new Runnable() { + @Override + public void run() { + editorMain.init(); + } + }; + new Thread(testThread).start(); + while (editorMain.getState().equals(EditorState.READY) + || editorMain.getState().equals(EditorState.INITIALIZING)) { + Thread.sleep(100); + } + + editorMain.shutdown(); + final String outString = outBAStream.toString(); + System.out.println(outString); + return outString; + } +} diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java new file mode 100644 index 000000000..c60fb8f4c --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/TestExceptions.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest; + +import static org.junit.Assert.assertNotNull; + +import java.io.IOException; + +import org.junit.Test; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestExceptions { + + @Test + public void test() { + assertNotNull(new ApexEditorException("Message")); + assertNotNull(new ApexEditorException("Message", "Object of Exception")); + assertNotNull(new ApexEditorException("Message", new IOException())); + assertNotNull(new ApexEditorException("Message", new IOException(), "Object of Exception")); + } +} diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java new file mode 100644 index 000000000..5648e306f --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/BeanFake.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest.bean; + +import javax.xml.bind.annotation.XmlType; + +/** + * The Event Bean. + */ +@XmlType +public class BeanFake extends BeanBase { + + private String name = null, version = null, field1 = null; + private int field2 = 0, field3 = 0; + + public String getName() { + field1 = name; + return field1; + } + + public String getVersion() { + return version; + } + + public int getField2() { + field3 = field2; + return field3; + } +} diff --git a/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java new file mode 100644 index 000000000..50d330bf8 --- /dev/null +++ b/client/client-editor/src/test/java/org/onap/policy/apex/client/editor/rest/bean/TestBeans.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.apex.client.editor.rest.bean; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; + +import org.junit.Test; + +/** + * @author Liam Fallon (liam.fallon@ericsson.com) + */ +public class TestBeans { + + @Test + public void testBeans() { + assertNotNull(new BeanEvent().toString()); + assertNotNull(new BeanState().toString()); + assertNotNull(new BeanContextAlbum().toString()); + assertNotNull(new BeanPolicy().toString()); + assertNotNull(new BeanContextSchema().toString()); + assertNotNull(new BeanField().toString()); + assertNotNull(new BeanModel().toString()); + assertNotNull(new BeanLogic().toString()); + assertNotNull(new BeanStateOutput().toString()); + assertNotNull(new BeanTaskParameter().toString()); + assertNotNull(new BeanKeyRef().toString()); + assertNotNull(new BeanStateTaskRef().toString()); + assertNotNull(new BeanTask().toString()); + + final BeanState beanState = new BeanState(); + assertNull(beanState.getName()); + beanState.setDefaultTask(new BeanKeyRef()); + assertNotNull(beanState.getDefaultTask()); + + final BeanEvent beanEvent = new BeanEvent(); + assertNull(beanEvent.get("name")); + + final BeanFake beanFake = new BeanFake(); + assertNull(beanFake.get("name")); + assertNull(beanFake.get("field1")); + + try { + beanFake.get("iDontExist"); + fail("test should throw an exception here"); + } catch (final IllegalArgumentException e) { + assertNotNull(e); + } + try { + beanFake.get("nome"); + fail("test should throw an exception here"); + } catch (final IllegalArgumentException e) { + assertNotNull(e); + } + try { + beanFake.get("field2"); + fail("test should throw an exception here"); + } catch (final IllegalArgumentException e) { + assertNotNull(e); + } + try { + beanFake.get("field3"); + fail("test should throw an exception here"); + } catch (final IllegalArgumentException e) { + assertNotNull(e); + } + } +} diff --git a/client/client-editor/src/test/resources/models/PolicyModel.json b/client/client-editor/src/test/resources/models/PolicyModel.json new file mode 100644 index 000000000..81c222609 --- /dev/null +++ b/client/client-editor/src/test/resources/models/PolicyModel.json @@ -0,0 +1,708 @@ +{ + "apexPolicyModel" : { + "key" : { + "name" : "PolicyModel", + "version" : "0.0.1" + }, + "keyInformation" : { + "key" : { + "name" : "KeyInfoMapKey", + "version" : "0.0.1" + }, + "keyInfoMap" : { + "entry" : [ { + "key" : { + "name" : "ContextSchemas", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "ContextSchemas", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e000", + "description" : "Generated description for concept referred to by key \"ContextSchemas:0.0.1\"" + } + }, { + "key" : { + "name" : "KeyInfoMapKey", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "KeyInfoMapKey", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e001", + "description" : "Generated description for concept referred to by key \"KeyInfoMapKey:0.0.1\"" + } + }, { + "key" : { + "name" : "MapType", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MapType", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e002", + "description" : "Generated description for concept referred to by key \"MapType:0.0.1\"" + } + }, { + "key" : { + "name" : "PolicyModel", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "PolicyModel", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e003", + "description" : "Generated description for concept referred to by key \"PolicyModel:0.0.1\"" + } + }, { + "key" : { + "name" : "StringType", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "StringType", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e004", + "description" : "Generated description for concept referred to by key \"StringType:0.0.1\"" + } + }, { + "key" : { + "name" : "context", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "context", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e005", + "description" : "Generated description for concept referred to by key \"context:0.0.1\"" + } + }, { + "key" : { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e006", + "description" : "Generated description for concept referred to by key \"contextAlbum0:0.0.1\"" + } + }, { + "key" : { + "name" : "contextAlbum1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "contextAlbum1", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e007", + "description" : "Generated description for concept referred to by key \"contextAlbum1:0.0.1\"" + } + }, { + "key" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e008", + "description" : "Generated description for concept referred to by key \"eventContextItem0:0.0.1\"" + } + }, { + "key" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e009", + "description" : "Generated description for concept referred to by key \"eventContextItem1:0.0.1\"" + } + }, { + "key" : { + "name" : "events", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "events", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e010", + "description" : "Generated description for concept referred to by key \"events:0.0.1\"" + } + }, { + "key" : { + "name" : "inEvent", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "inEvent", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e011", + "description" : "Generated description for concept referred to by key \"inEvent:0.0.1\"" + } + }, { + "key" : { + "name" : "outEvent0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "outEvent0", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e012", + "description" : "Generated description for concept referred to by key \"outEvent0:0.0.1\"" + } + }, { + "key" : { + "name" : "outEvent1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "outEvent1", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e013", + "description" : "Generated description for concept referred to by key \"outEvent1:0.0.1\"" + } + }, { + "key" : { + "name" : "policies", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "policies", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e014", + "description" : "Generated description for concept referred to by key \"policies:0.0.1\"" + } + }, { + "key" : { + "name" : "policy", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "policy", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e015", + "description" : "Generated description for concept referred to by key \"policy:0.0.1\"" + } + }, { + "key" : { + "name" : "task", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "task", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e016", + "description" : "Generated description for concept referred to by key \"task:0.0.1\"" + } + }, { + "key" : { + "name" : "tasks", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "tasks", + "version" : "0.0.1" + }, + "UUID" : "0ce9168c-e6df-414f-9646-6da464b6e017", + "description" : "Generated description for concept referred to by key \"tasks:0.0.1\"" + } + } ] + } + }, + "policies" : { + "key" : { + "name" : "policies", + "version" : "0.0.1" + }, + "policyMap" : { + "entry" : [ { + "key" : { + "name" : "policy", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "policy", + "version" : "0.0.1" + }, + "template" : "FREEFORM", + "state" : { + "entry" : [ { + "key" : "state", + "value" : { + "stateKey" : { + "parentKeyName" : "policy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "state" + }, + "trigger" : { + "name" : "inEvent", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "stateOutput0", + "value" : { + "key" : { + "parentKeyName" : "policy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "state", + "localName" : "stateOutput0" + }, + "outgoingEvent" : { + "name" : "outEvent0", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, { + "name" : "contextAlbum1", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "taskSelectionLogic", + "logicFlavour" : "MVEL", + "logic" : "Some TS logic" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "task", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "task", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "policy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "state", + "localName" : "task" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "policy", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "state", + "localName" : "stateOutput0" + } + } + } ] + } + } + } ] + }, + "firstState" : "state" + } + } ] + } + }, + "tasks" : { + "key" : { + "name" : "tasks", + "version" : "0.0.1" + }, + "taskMap" : { + "entry" : [ { + "key" : { + "name" : "task", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "task", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "IEPAR0", + "value" : { + "key" : "IEPAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "IEPAR1", + "value" : { + "key" : "IEPAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "OE0PAR0", + "value" : { + "key" : "OE0PAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "OE0PAR1", + "value" : { + "key" : "OE0PAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + }, { + "key" : "OE1PAR0", + "value" : { + "key" : "OE1PAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "OE1PAR1", + "value" : { + "key" : "OE1PAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "taskParameter0", + "value" : { + "key" : { + "parentKeyName" : "task", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "taskParameter0" + }, + "defaultValue" : "Task parameter 0 value" + } + }, { + "key" : "taskParameter1", + "value" : { + "key" : { + "parentKeyName" : "task", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "taskParameter1" + }, + "defaultValue" : "Task parameter 1 value" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, { + "name" : "contextAlbum1", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "taskLogic", + "logicFlavour" : "MVEL", + "logic" : "Some task logic" + } + } + } ] + } + }, + "events" : { + "key" : { + "name" : "events", + "version" : "0.0.1" + }, + "eventMap" : { + "entry" : [ { + "key" : { + "name" : "inEvent", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "inEvent", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.model.policymodel.events", + "source" : "Source", + "target" : "Target", + "parameter" : { + "entry" : [ { + "key" : "IEPAR0", + "value" : { + "key" : "IEPAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "IEPAR1", + "value" : { + "key" : "IEPAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "outEvent0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "outEvent0", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.model.policymodel.events", + "source" : "Source", + "target" : "Target", + "parameter" : { + "entry" : [ { + "key" : "OE0PAR0", + "value" : { + "key" : "OE0PAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "OE0PAR1", + "value" : { + "key" : "OE0PAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + }, { + "key" : "OE1PAR0", + "value" : { + "key" : "OE1PAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "OE1PAR1", + "value" : { + "key" : "OE1PAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "outEvent1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "outEvent1", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.model.policymodel.events", + "source" : "Source", + "target" : "Target", + "parameter" : { + "entry" : [ { + "key" : "OE1PAR0", + "value" : { + "key" : "OE1PAR0", + "fieldSchemaKey" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + } + } + }, { + "key" : "OE1PAR1", + "value" : { + "key" : "OE1PAR1", + "fieldSchemaKey" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + } + } + } ] + } + } + } ] + } + }, + "albums" : { + "key" : { + "name" : "context", + "version" : "0.0.1" + }, + "albums" : { + "entry" : [ { + "key" : { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "contextAlbum0", + "version" : "0.0.1" + }, + "scope" : "APPLICATION", + "isWritable" : true, + "itemSchema" : { + "name" : "MapType", + "version" : "0.0.1" + } + } + }, { + "key" : { + "name" : "contextAlbum1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "contextAlbum1", + "version" : "0.0.1" + }, + "scope" : "GLOBAL", + "isWritable" : false, + "itemSchema" : { + "name" : "StringType", + "version" : "0.0.1" + } + } + } ] + } + }, + "schemas" : { + "key" : { + "name" : "ContextSchemas", + "version" : "0.0.1" + }, + "schemas" : { + "entry" : [ { + "key" : { + "name" : "MapType", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MapType", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.model.policymodel.concepts.TestContextItem00A" + } + }, { + "key" : { + "name" : "StringType", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "StringType", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.model.policymodel.concepts.TestContextItem000" + } + }, { + "key" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "eventContextItem0", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "eventContextItem1", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + } ] + } + } + } +}
\ No newline at end of file diff --git a/client/client-editor/src/test/resources/models/SamplePolicyModelMVEL.json b/client/client-editor/src/test/resources/models/SamplePolicyModelMVEL.json new file mode 100644 index 000000000..a0ab6d6dd --- /dev/null +++ b/client/client-editor/src/test/resources/models/SamplePolicyModelMVEL.json @@ -0,0 +1,6369 @@ +{ + "apexPolicyModel" : { + "key" : { + "name" : "SamplePolicyModelMVEL", + "version" : "0.0.1" + }, + "keyInformation" : { + "key" : { + "name" : "KeyInformation", + "version" : "0.0.1" + }, + "keyInfoMap" : { + "entry" : [ { + "key" : { + "name" : "Context", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Context", + "version" : "0.0.1" + }, + "UUID" : "4f98dea9-de86-4cc3-9927-f9cd30809b0c", + "description" : "Generated description for concept referred to by key \"Context:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0000", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0000", + "version" : "0.0.1" + }, + "UUID" : "57c1cd75-55a0-4716-9e38-81165b77cdd2", + "description" : "Generated description for concept referred to by key \"Event0000:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "UUID" : "1dde5bc6-aafd-4bb5-8d85-60da3ee258b4", + "description" : "Generated description for concept referred to by key \"Event0001:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "UUID" : "cc9a985b-afe7-45f9-8734-efc914b35438", + "description" : "Generated description for concept referred to by key \"Event0002:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "UUID" : "efcccec8-5da4-46f4-9933-121f892d234c", + "description" : "Generated description for concept referred to by key \"Event0003:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0004", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0004", + "version" : "0.0.1" + }, + "UUID" : "fa9ded48-f906-409e-93c5-ee55ee45b331", + "description" : "Generated description for concept referred to by key \"Event0004:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0100", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0100", + "version" : "0.0.1" + }, + "UUID" : "0bee1dd2-09d8-4848-bb0f-c826837b1215", + "description" : "Generated description for concept referred to by key \"Event0100:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "UUID" : "7812ac69-7fe7-447e-97d1-a4f903d58670", + "description" : "Generated description for concept referred to by key \"Event0101:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "UUID" : "0dfd19a1-1177-4a7a-9166-441b0b96ec71", + "description" : "Generated description for concept referred to by key \"Event0102:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "UUID" : "54c66823-0eb1-40fd-8041-6f3788d3163b", + "description" : "Generated description for concept referred to by key \"Event0103:0.0.1\"" + } + }, { + "key" : { + "name" : "Event0104", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0104", + "version" : "0.0.1" + }, + "UUID" : "b68dc6c2-436e-41f8-92df-6f14322b2d02", + "description" : "Generated description for concept referred to by key \"Event0104:0.0.1\"" + } + }, { + "key" : { + "name" : "Events", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Events", + "version" : "0.0.1" + }, + "UUID" : "b94096a5-b994-4786-87b9-33ae1d8ff3ec", + "description" : "Generated description for concept referred to by key \"Events:0.0.1\"" + } + }, { + "key" : { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, + "UUID" : "6227e0f8-f351-4bcd-a8f2-f2ce0adde0c7", + "description" : "Generated description for concept referred to by key \"ExternalContextAlbum:0.0.1\"" + } + }, { + "key" : { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, + "UUID" : "27c4d24b-bec0-4904-8eec-36c2d37f93c1", + "description" : "Generated description for concept referred to by key \"GlobalContextAlbum:0.0.1\"" + } + }, { + "key" : { + "name" : "KeyInformation", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "KeyInformation", + "version" : "0.0.1" + }, + "UUID" : "7c0f9f8a-22e9-454f-9d99-0d48abb31c84", + "description" : "Generated description for concept referred to by key \"KeyInformation:0.0.1\"" + } + }, { + "key" : { + "name" : "MyEvent", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "MyEvent", + "version" : "0.0.1" + }, + "UUID" : "5186c439-7f48-4097-8246-f8e9e5774ce2", + "description" : "Generated description for a concept called \"MyEvent\" with version \"0.0.1\" and UUID \"5186c439-7f48-4097-8246-f8e9e5774ce2\"" + } + }, { + "key" : { + "name" : "Policies", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policies", + "version" : "0.0.1" + }, + "UUID" : "6de2d1fd-4e69-487e-bd44-7508ca60c887", + "description" : "Generated description for concept referred to by key \"Policies:0.0.1\"" + } + }, { + "key" : { + "name" : "Policy0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy0", + "version" : "0.0.1" + }, + "UUID" : "18d8fea6-b32a-4d5b-b775-f5d41c540089", + "description" : "Generated description for concept referred to by key \"Policy0:0.0.1\"" + } + }, { + "key" : { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, + "UUID" : "cbc9b85a-8588-449b-9bac-8b459692a5bd", + "description" : "Generated description for concept referred to by key \"Policy0ContextAlbum:0.0.1\"" + } + }, { + "key" : { + "name" : "Policy1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy1", + "version" : "0.0.1" + }, + "UUID" : "5dc44d18-bfa2-460d-bd92-114250f1986a", + "description" : "Generated description for concept referred to by key \"Policy1:0.0.1\"" + } + }, { + "key" : { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + }, + "UUID" : "8e241143-7bfa-4475-bca8-1e7ba5fa9901", + "description" : "Generated description for concept referred to by key \"Policy1ContextAlbum:0.0.1\"" + } + }, { + "key" : { + "name" : "SamplePolicyModelMVEL", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "SamplePolicyModelMVEL", + "version" : "0.0.1" + }, + "UUID" : "20df0615-4364-40c2-bd25-990a17fd6e37", + "description" : "Generated description for concept referred to by key \"SamplePolicyModelMVEL:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "UUID" : "d8b9a5bd-9185-4191-8223-183acf68e6c2", + "description" : "Generated description for concept referred to by key \"Task_Act0:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "UUID" : "16bcf3fa-de67-4ad6-b909-56bab3585e3c", + "description" : "Generated description for concept referred to by key \"Task_Act1:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "UUID" : "e09e4910-4feb-4833-9096-d3c00efdf5f1", + "description" : "Generated description for concept referred to by key \"Task_Act2:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "UUID" : "5c3b0705-5789-438d-93c0-9cb45fbd4e35", + "description" : "Generated description for concept referred to by key \"Task_Act3:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "UUID" : "adba4a16-b529-4dbd-8609-d428c0b77524", + "description" : "Generated description for concept referred to by key \"Task_Decide0:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "UUID" : "3126b891-f520-4a62-ac64-bf23ada256b4", + "description" : "Generated description for concept referred to by key \"Task_Decide1:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "UUID" : "8e0e528f-e1cb-4d40-b5ee-187a39a339af", + "description" : "Generated description for concept referred to by key \"Task_Decide2:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "UUID" : "c6330c83-1b6c-47f8-8c3b-01d44c13297e", + "description" : "Generated description for concept referred to by key \"Task_Decide3:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "UUID" : "5e5dc5e2-7002-4344-94ba-3a92f4e9cd4a", + "description" : "Generated description for concept referred to by key \"Task_Establish0:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "UUID" : "44948ff0-dd44-4949-86ba-57eb37ab6940", + "description" : "Generated description for concept referred to by key \"Task_Establish1:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "UUID" : "a8348c59-a59f-4577-9a63-e463ed78a386", + "description" : "Generated description for concept referred to by key \"Task_Establish2:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "UUID" : "55952589-0c73-4785-ab80-3cc01ce3c5c5", + "description" : "Generated description for concept referred to by key \"Task_Establish3:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "UUID" : "877ae90c-9054-45b9-9854-04b052233bce", + "description" : "Generated description for concept referred to by key \"Task_Match0:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "UUID" : "43de7dd5-1c78-457a-a2d4-861d88365e32", + "description" : "Generated description for concept referred to by key \"Task_Match1:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "UUID" : "201a7923-aaa8-41f0-9248-039ed73ad90a", + "description" : "Generated description for concept referred to by key \"Task_Match2:0.0.1\"" + } + }, { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "UUID" : "712e9bf6-b62c-4028-9ffa-1eccd2b40a92", + "description" : "Generated description for concept referred to by key \"Task_Match3:0.0.1\"" + } + }, { + "key" : { + "name" : "Tasks", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Tasks", + "version" : "0.0.1" + }, + "UUID" : "db489db2-b91f-46b4-b353-232bfc07cfed", + "description" : "Generated description for concept referred to by key \"Tasks:0.0.1\"" + } + }, { + "key" : { + "name" : "TestCase", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestCase", + "version" : "0.0.1" + }, + "UUID" : "99a579f1-d903-4edb-9b7f-1ab6b6902bbf", + "description" : "Generated description for concept referred to by key \"TestCase:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem000", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem000", + "version" : "0.0.1" + }, + "UUID" : "87240d21-8241-4d63-bdca-b059efbc12be", + "description" : "Generated description for concept referred to by key \"TestContextItem000:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem001", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem001", + "version" : "0.0.1" + }, + "UUID" : "cf2f947b-d844-4015-8d09-60c1bfe1d1b9", + "description" : "Generated description for concept referred to by key \"TestContextItem001:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem002", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem002", + "version" : "0.0.1" + }, + "UUID" : "9da82bb8-5444-4e19-9ed6-be98db315885", + "description" : "Generated description for concept referred to by key \"TestContextItem002:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem003", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem003", + "version" : "0.0.1" + }, + "UUID" : "1e492a3f-f677-4a4e-be2e-dc37d468561e", + "description" : "Generated description for concept referred to by key \"TestContextItem003:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem004", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem004", + "version" : "0.0.1" + }, + "UUID" : "69ce656a-14c7-4c85-96d3-ced7613335d2", + "description" : "Generated description for concept referred to by key \"TestContextItem004:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem005", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem005", + "version" : "0.0.1" + }, + "UUID" : "fd8d2834-ddff-41e8-a519-17a5d68ac58a", + "description" : "Generated description for concept referred to by key \"TestContextItem005:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem006", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem006", + "version" : "0.0.1" + }, + "UUID" : "43b16640-5c95-4818-b57c-c9e526fbea4b", + "description" : "Generated description for concept referred to by key \"TestContextItem006:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem007", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem007", + "version" : "0.0.1" + }, + "UUID" : "c9dab805-f205-42e8-81cf-c104ab236be0", + "description" : "Generated description for concept referred to by key \"TestContextItem007:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem008", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem008", + "version" : "0.0.1" + }, + "UUID" : "179c8adb-ddd6-43ab-9011-1369bdc96160", + "description" : "Generated description for concept referred to by key \"TestContextItem008:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem009", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem009", + "version" : "0.0.1" + }, + "UUID" : "5110278d-c6b7-4086-a4fb-b4b0d860a3e1", + "description" : "Generated description for concept referred to by key \"TestContextItem009:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem00A", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00A", + "version" : "0.0.1" + }, + "UUID" : "6d289f0f-8b78-46ee-9562-9a24926cb3e9", + "description" : "Generated description for concept referred to by key \"TestContextItem00A:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem00B", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00B", + "version" : "0.0.1" + }, + "UUID" : "9ad1f442-ce0a-4906-ae0a-03f96956dec4", + "description" : "Generated description for concept referred to by key \"TestContextItem00B:0.0.1\"" + } + }, { + "key" : { + "name" : "TestContextItem00C", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00C", + "version" : "0.0.1" + }, + "UUID" : "41ab1873-cd05-4941-9529-faf7bf38cb73", + "description" : "Generated description for concept referred to by key \"TestContextItem00C:0.0.1\"" + } + }, { + "key" : { + "name" : "TestDatatypes", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestDatatypes", + "version" : "0.0.1" + }, + "UUID" : "8cb499dc-503e-4bce-8563-3b35a20b2dc4", + "description" : "Generated description for concept referred to by key \"TestDatatypes:0.0.1\"" + } + }, { + "key" : { + "name" : "TestExternalContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestExternalContextItem", + "version" : "0.0.1" + }, + "UUID" : "8bddc8cc-035d-4681-beba-bbb59bf3388f", + "description" : "Generated description for concept referred to by key \"TestExternalContextItem:0.0.1\"" + } + }, { + "key" : { + "name" : "TestGlobalContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestGlobalContextItem", + "version" : "0.0.1" + }, + "UUID" : "14aaae24-ddd0-47ff-a603-665f422583ab", + "description" : "Generated description for concept referred to by key \"TestGlobalContextItem:0.0.1\"" + } + }, { + "key" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + }, + "UUID" : "ee0fe52a-99ea-4ad7-84f9-235d09ad6ffc", + "description" : "Generated description for concept referred to by key \"TestPolicyContextItem:0.0.1\"" + } + }, { + "key" : { + "name" : "TestSlogan", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestSlogan", + "version" : "0.0.1" + }, + "UUID" : "a99806a3-46a7-48b0-9c44-524eb827e30d", + "description" : "Generated description for concept referred to by key \"TestSlogan:0.0.1\"" + } + }, { + "key" : { + "name" : "TestTemperature", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestTemperature", + "version" : "0.0.1" + }, + "UUID" : "bc21b814-84e5-42a0-9965-3732fb3acbf9", + "description" : "Generated description for concept referred to by key \"TestTemperature:0.0.1\"" + } + }, { + "key" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + }, + "UUID" : "afa5ad6d-c09d-4843-90df-6d3d1995e6ce", + "description" : "Generated description for concept referred to by key \"TestTimestamp:0.0.1\"" + } + } ] + } + }, + "policies" : { + "key" : { + "name" : "Policies", + "version" : "0.0.1" + }, + "policyMap" : { + "entry" : [ { + "key" : { + "name" : "Policy0", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "Policy0", + "version" : "0.0.1" + }, + "template" : "MEDA", + "state" : { + "entry" : [ { + "key" : "Establish", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Establish" + }, + "trigger" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Establish_Decide", + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + }, + "outgoingEvent" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Decide" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish0_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish1_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish2_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish3_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + } ] + } + } + }, { + "key" : "Act", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Act" + }, + "trigger" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Act_NULL", + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + }, + "outgoingEvent" : { + "name" : "Event0004", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ { + "key" : "Act_LOGIC", + "value" : { + "key" : "", + "logicFlavour" : "MVEL", + "logic" : "\nTHis is a test finaliser logic!!!!\nlogger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;\nTHis is a test finaliser logic!!!!" + } + } ] + }, + "defaultTask" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act3_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act0_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act2_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act1_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + } ] + } + } + }, { + "key" : "Decide", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Decide" + }, + "trigger" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Decide_Act", + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + }, + "outgoingEvent" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Act" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide1_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide2_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide3_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide0_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + } ] + } + } + }, { + "key" : "Match", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Match" + }, + "trigger" : { + "name" : "Event0000", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Match_Establish", + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + }, + "outgoingEvent" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Establish" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match2_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match3_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match0_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match1_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + } ] + } + } + } ] + }, + "firstState" : "Match" + } + }, { + "key" : { + "name" : "Policy1", + "version" : "0.0.1" + }, + "value" : { + "policyKey" : { + "name" : "Policy1", + "version" : "0.0.1" + }, + "template" : "MEDA", + "state" : { + "entry" : [ { + "key" : "Establish", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Establish" + }, + "trigger" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Establish_Decide", + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + }, + "outgoingEvent" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Decide" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish0_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish1_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish2_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + }, { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Task_Establish3_DIRECT_Establish_Decide" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Establish", + "localName" : "Establish_Decide" + } + } + } ] + } + } + }, { + "key" : "Act", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Act" + }, + "trigger" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Act_NULL", + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + }, + "outgoingEvent" : { + "name" : "Event0104", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "NULL", + "parentKeyVersion" : "0.0.0", + "parentLocalName" : "NULL", + "localName" : "NULL" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act3_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act0_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act2_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + }, { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Task_Act1_DIRECT_Act_NULL" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Act", + "localName" : "Act_NULL" + } + } + } ] + } + } + }, { + "key" : "Decide", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Decide" + }, + "trigger" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Decide_Act", + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + }, + "outgoingEvent" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Act" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide1_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide2_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide3_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + }, { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Task_Decide0_DIRECT_Decide_Act" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Decide", + "localName" : "Decide_Act" + } + } + } ] + } + } + }, { + "key" : "Match", + "value" : { + "stateKey" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Match" + }, + "trigger" : { + "name" : "Event0100", + "version" : "0.0.1" + }, + "stateOutputs" : { + "entry" : [ { + "key" : "Match_Establish", + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + }, + "outgoingEvent" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "nextState" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Establish" + } + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskSelectionLogic" : { + "key" : "TaskSelectionLigic", + "logicFlavour" : "MVEL", + "logic" : "logger.debug(subject.id + \":\" + subject.stateName);\nsubject.defaultTaskKey.copyTo(ko);\nreturn true;" + }, + "stateFinalizerLogicMap" : { + "entry" : [ ] + }, + "defaultTask" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "taskReferences" : { + "entry" : [ { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match2_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match3_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match0_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + }, { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Task_Match1_DIRECT_Match_Establish" + }, + "outputType" : "DIRECT", + "output" : { + "parentKeyName" : "Policy1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "Match", + "localName" : "Match_Establish" + } + } + } ] + } + } + } ] + }, + "firstState" : "Match" + } + } ] + } + }, + "tasks" : { + "key" : { + "name" : "Tasks", + "version" : "0.0.1" + }, + "taskMap" : { + "entry" : [ { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act0", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter2", + "value" : { + "key" : { + "parentKeyName" : "Task_Act0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter2" + }, + "defaultValue" : "DefaultValue2" + } + }, { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Act0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Act0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestActCaseSelected\"] = (byte)2;\ntimeNow = new Date();\noutFields[\"TestActStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act1", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Act1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Act1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestActCaseSelected\"] = (byte)3;\ntimeNow = new Date();\noutFields[\"TestActStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act2", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Act2", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestActCaseSelected\"] = (byte)0;\ntimeNow = new Date();\noutFields[\"TestActStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Act3", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Act3", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestActCaseSelected\"] = (byte)1;\ntimeNow = new Date();\noutFields[\"TestActStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide0", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter2", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter2" + }, + "defaultValue" : "DefaultValue2" + } + }, { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestDecideCaseSelected\"] = (byte)2;\ntimeNow = new Date();\noutFields[\"TestDecideStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide1", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestDecideCaseSelected\"] = (byte)3;\ntimeNow = new Date();\noutFields[\"TestDecideStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide2", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide2", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestDecideCaseSelected\"] = (byte)0;\ntimeNow = new Date();\noutFields[\"TestDecideStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Decide3", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Decide3", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestDecideCaseSelected\"] = (byte)1;\ntimeNow = new Date();\noutFields[\"TestDecideStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish0", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter2", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter2" + }, + "defaultValue" : "DefaultValue2" + } + }, { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestEstablishCaseSelected\"] = (byte)2;\ntimeNow = new Date();\noutFields[\"TestEstablishStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish1", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestEstablishCaseSelected\"] = (byte)3;\ntimeNow = new Date();\noutFields[\"TestEstablishStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish2", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish2", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestEstablishCaseSelected\"] = (byte)0;\ntimeNow = new Date();\noutFields[\"TestEstablishStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Establish3", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Establish3", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestEstablishCaseSelected\"] = (byte)1;\ntimeNow = new Date();\noutFields[\"TestEstablishStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match0", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter2", + "value" : { + "key" : { + "parentKeyName" : "Task_Match0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter2" + }, + "defaultValue" : "DefaultValue2" + } + }, { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Match0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Match0", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestMatchCaseSelected\"] = (byte)2;\ntimeNow = new Date();\noutFields[\"TestMatchStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match1", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter1", + "value" : { + "key" : { + "parentKeyName" : "Task_Match1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter1" + }, + "defaultValue" : "DefaultValue1" + } + }, { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Match1", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestMatchCaseSelected\"] = (byte)3;\ntimeNow = new Date();\noutFields[\"TestMatchStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match2", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Match2", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestMatchCaseSelected\"] = (byte)0;\ntimeNow = new Date();\noutFields[\"TestMatchStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + }, { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Task_Match3", + "version" : "0.0.1" + }, + "inputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + }, + "outputFields" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + }, + "taskParameters" : { + "entry" : [ { + "key" : "Parameter0", + "value" : { + "key" : { + "parentKeyName" : "Task_Match3", + "parentKeyVersion" : "0.0.1", + "parentLocalName" : "NULL", + "localName" : "Parameter0" + }, + "defaultValue" : "DefaultValue0" + } + } ] + }, + "contextAlbumReference" : [ { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + } ], + "taskLogic" : { + "key" : "_TaskLogic", + "logicFlavour" : "MVEL", + "logic" : "import java.util.Date;\nlogger.debug(subject.id);\ngc = getContextAlbum(\"GlobalContextAlbum\");\nlogger.debug(gc);\nlogger.debug(inFields);\noutFields[\"TestMatchCaseSelected\"] = (byte)1;\ntimeNow = new Date();\noutFields[\"TestMatchStateTime\"] = timeNow.getTime();\nlogger.debug(outFields);\nreturn true;" + } + } + } ] + } + }, + "events" : { + "key" : { + "name" : "Events", + "version" : "0.0.1" + }, + "eventMap" : { + "entry" : [ { + "key" : { + "name" : "Event0000", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0000", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Outside", + "target" : "Match", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0001", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Match", + "target" : "Establish", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0002", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Establish", + "target" : "Decide", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0003", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Decide", + "target" : "Act", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0004", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0004", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Act", + "target" : "Outside", + "parameter" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0100", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0100", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Outside", + "target" : "Match", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0101", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Match", + "target" : "Establish", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0102", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Establish", + "target" : "Decide", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0103", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Decide", + "target" : "Act", + "parameter" : { + "entry" : [ { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + }, { + "key" : { + "name" : "Event0104", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Event0104", + "version" : "0.0.1" + }, + "nameSpace" : "org.onap.policy.apex.domains.sample.events", + "source" : "Act", + "target" : "Outside", + "parameter" : { + "entry" : [ { + "key" : "TestActCaseSelected", + "value" : { + "key" : "TestActCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestActStateTime", + "value" : { + "key" : "TestActStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTemperature", + "value" : { + "key" : "TestTemperature", + "fieldSchemaKey" : { + "name" : "TestTemperature", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideCaseSelected", + "value" : { + "key" : "TestDecideCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCaseSelected", + "value" : { + "key" : "TestMatchCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestTimestamp", + "value" : { + "key" : "TestTimestamp", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestDecideStateTime", + "value" : { + "key" : "TestDecideStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchCase", + "value" : { + "key" : "TestMatchCase", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestSlogan", + "value" : { + "key" : "TestSlogan", + "fieldSchemaKey" : { + "name" : "TestSlogan", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishCaseSelected", + "value" : { + "key" : "TestEstablishCaseSelected", + "fieldSchemaKey" : { + "name" : "TestCase", + "version" : "0.0.1" + } + } + }, { + "key" : "TestEstablishStateTime", + "value" : { + "key" : "TestEstablishStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + }, { + "key" : "TestMatchStateTime", + "value" : { + "key" : "TestMatchStateTime", + "fieldSchemaKey" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + } + } + } ] + } + } + } ] + } + }, + "albums" : { + "key" : { + "name" : "Context", + "version" : "0.0.1" + }, + "albums" : { + "entry" : [ { + "key" : { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "ExternalContextAlbum", + "version" : "0.0.1" + }, + "scope" : "EXTERNAL", + "isWritable" : false, + "itemSchema" : { + "name" : "TestExternalContextItem", + "version" : "0.0.1" + } + } + }, { + "key" : { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "GlobalContextAlbum", + "version" : "0.0.1" + }, + "scope" : "GLOBAL", + "isWritable" : true, + "itemSchema" : { + "name" : "TestGlobalContextItem", + "version" : "0.0.1" + } + } + }, { + "key" : { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy0ContextAlbum", + "version" : "0.0.1" + }, + "scope" : "APPLICATION", + "isWritable" : true, + "itemSchema" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + } + } + }, { + "key" : { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "Policy1ContextAlbum", + "version" : "0.0.1" + }, + "scope" : "APPLICATION", + "isWritable" : true, + "itemSchema" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + } + } + } ] + } + }, + "schemas" : { + "key" : { + "name" : "TestDatatypes", + "version" : "0.0.1" + }, + "schemas" : { + "entry" : [ { + "key" : { + "name" : "TestCase", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestCase", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Byte" + } + }, { + "key" : { + "name" : "TestContextItem000", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem000", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem000" + } + }, { + "key" : { + "name" : "TestContextItem001", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem001", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem001" + } + }, { + "key" : { + "name" : "TestContextItem002", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem002", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem002" + } + }, { + "key" : { + "name" : "TestContextItem003", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem003", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem003" + } + }, { + "key" : { + "name" : "TestContextItem004", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem004", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem004" + } + }, { + "key" : { + "name" : "TestContextItem005", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem005", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem005" + } + }, { + "key" : { + "name" : "TestContextItem006", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem006", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem006" + } + }, { + "key" : { + "name" : "TestContextItem007", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem007", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem007" + } + }, { + "key" : { + "name" : "TestContextItem008", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem008", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem008" + } + }, { + "key" : { + "name" : "TestContextItem009", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem009", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem009" + } + }, { + "key" : { + "name" : "TestContextItem00A", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00A", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem00A" + } + }, { + "key" : { + "name" : "TestContextItem00B", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00B", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem00B" + } + }, { + "key" : { + "name" : "TestContextItem00C", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestContextItem00C", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestContextItem00C" + } + }, { + "key" : { + "name" : "TestExternalContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestExternalContextItem", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestExternalContextItem" + } + }, { + "key" : { + "name" : "TestGlobalContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestGlobalContextItem", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestGlobalContextItem" + } + }, { + "key" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestPolicyContextItem", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "org.onap.policy.apex.context.test.concepts.TestPolicyContextItem" + } + }, { + "key" : { + "name" : "TestSlogan", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestSlogan", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.String" + } + }, { + "key" : { + "name" : "TestTemperature", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestTemperature", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Double" + } + }, { + "key" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + }, + "value" : { + "key" : { + "name" : "TestTimestamp", + "version" : "0.0.1" + }, + "schemaFlavour" : "Java", + "schemaDefinition" : "java.lang.Long" + } + } ] + } + } + } +} + |