aboutsummaryrefslogtreecommitdiffstats
path: root/packages/apex-pdp-package-full/src/main/package/examples/html
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-07-24 17:36:53 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-07-25 11:47:15 +0100
commitd524cedc578ae1bfa3bae895b3170f87463cbed9 (patch)
tree0740644e356534f770d59ff34f16e5d9ca601276 /packages/apex-pdp-package-full/src/main/package/examples/html
parent41ecf036b7f1b3bdd56311a0bc706407b242faca (diff)
Adding more examples to apex-pdp
- Adding more examples (DecisionMaker, Periodic & ONAPvCPE) to apex-pdp. - Fixed CORS issue in plugin-event-carrier-restserver module. Added a ContainerResponseFilter to intercept every request/response coming to REST server and add the required headers to support CORS. Change-Id: Ic3e36c683f2a78992ce1417d2c00233b34066f2f Issue-ID: POLICY-861 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'packages/apex-pdp-package-full/src/main/package/examples/html')
-rw-r--r--packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html156
-rw-r--r--packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html156
-rw-r--r--packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html153
-rw-r--r--packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html153
4 files changed, 618 insertions, 0 deletions
diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html
new file mode 100644
index 000000000..1077939b0
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Client.html
@@ -0,0 +1,156 @@
+<!--
+ ============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=========================================================
+-->
+
+<!-- http://localhost:3904/events/toApex -->
+
+<html>
+<head>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script>
+ $(document).ready(function() {
+ $("#answerspost").click(function(e) {
+ var elements = document.getElementById("answerform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "AnswerEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "text" && element.value != "") {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:3904/events/toApex",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Answers Set Successfully !!!");
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+<script>
+ $(document).ready(function() {
+ $("#modepost").click(function(e) {
+ var elements = document.getElementById("modeform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "MakeDecisionEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "radio" && element.checked) {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:3904/events/toApex",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Decision Taken: " + data.decision);
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+</head>
+<body>
+ <h3>Decision Maker Answers</h3>
+ <form name="answerform" id="answerform" method="POST">
+ <table>
+ <tr>
+ <td>First Answer:</td>
+ <td><input type="text" name="a0" value="Never Ever" /></td>
+ </tr>
+ <tr>
+ <td>Second Answer:</td>
+ <td><input type="text" name="a1" value="No" /></td>
+ </tr>
+ <tr>
+ <td>Third Answer:</td>
+ <td><input type="text" name="a2" value="Maybe not" /></td>
+ </tr>
+ <tr>
+ <td>Fourth Answer</td>
+ <td><input type="text" name="a3" value="Wait" /></td>
+ </tr>
+ <tr>
+ <td>Fifth Answer:</td>
+ <td><input type="text" name="a4" value="Maybe" /></td>
+ </tr>
+ <tr>
+ <td>Sixth Answer:</td>
+ <td><input type="text" name="a5" value="Yes" /></td>
+ </tr>
+ <tr>
+ <td>Seventh Answer:</td>
+ <td><input type="text" name="a6" value="Absolutely" /></td>
+ </tr>
+ <tr>
+ <td />
+ <td><input type="button" class="btn btn-info" id="answerspost"
+ value="Set Answers"></td>
+ </tr>
+ </table>
+ </form>
+ <h3>Decision Maker Mode</h3>
+ <form name="modeform" id="modeform" method="POST">
+ <table>
+ <tr>
+ <td><input name="mode" type="radio" value="random"
+ checked="checked">random</td>
+ <td><input name="mode" type="radio" value="pessimistic">pessimistic</td>
+ <td><input name="mode" type="radio" value="optimistic">
+ optimistic</td>
+ <td><input name="mode" type="radio" value="dithering">dithering</td>
+ <td><input name="mode" type="radio" value="roundrobin">round
+ robin</td>
+ </tr>
+ <tr>
+ <td />
+ <td />
+ <td />
+ <td />
+ <td><input type="button" class="btn btn-info" id="modepost"
+ value="Make Decision"></td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html
new file mode 100644
index 000000000..06df67e59
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecisionExtraMode_Server.html
@@ -0,0 +1,156 @@
+<!--
+ ============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=========================================================
+-->
+
+<!-- http://localhost:23324/apex/EventIn -->
+
+<html>
+<head>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script>
+ $(document).ready(function() {
+ $("#answerspost").click(function(e) {
+ var elements = document.getElementById("answerform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "AnswerEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "text" && element.value != "") {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:23324/apex/RESTConsumer/EventIn",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Answers Set Successfully !!!");
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+<script>
+ $(document).ready(function() {
+ $("#modepost").click(function(e) {
+ var elements = document.getElementById("modeform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "MakeDecisionEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "radio" && element.checked) {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:23324/apex/RESTConsumer/EventIn",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Decision Taken: " + data.decision);
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+</head>
+<body>
+ <h3>Decision Maker Answers</h3>
+ <form name="answerform" id="answerform" method="POST">
+ <table>
+ <tr>
+ <td>First Answer:</td>
+ <td><input type="text" name="a0" value="Never Ever" /></td>
+ </tr>
+ <tr>
+ <td>Second Answer:</td>
+ <td><input type="text" name="a1" value="No" /></td>
+ </tr>
+ <tr>
+ <td>Third Answer:</td>
+ <td><input type="text" name="a2" value="Maybe not" /></td>
+ </tr>
+ <tr>
+ <td>Fourth Answer</td>
+ <td><input type="text" name="a3" value="Wait" /></td>
+ </tr>
+ <tr>
+ <td>Fifth Answer:</td>
+ <td><input type="text" name="a4" value="Maybe" /></td>
+ </tr>
+ <tr>
+ <td>Sixth Answer:</td>
+ <td><input type="text" name="a5" value="Yes" /></td>
+ </tr>
+ <tr>
+ <td>Seventh Answer:</td>
+ <td><input type="text" name="a6" value="Absolutely" /></td>
+ </tr>
+ <tr>
+ <td />
+ <td><input type="button" class="btn btn-info" id="answerspost"
+ value="Set Answers"></td>
+ </tr>
+ </table>
+ </form>
+ <h3>Decision Maker Mode</h3>
+ <form name="modeform" id="modeform" method="POST">
+ <table>
+ <tr>
+ <td><input name="mode" type="radio" value="random"
+ checked="checked">random</td>
+ <td><input name="mode" type="radio" value="pessimistic">pessimistic</td>
+ <td><input name="mode" type="radio" value="optimistic">
+ optimistic</td>
+ <td><input name="mode" type="radio" value="dithering">dithering</td>
+ <td><input name="mode" type="radio" value="roundrobin">round
+ robin</td>
+ </tr>
+ <tr>
+ <td />
+ <td />
+ <td />
+ <td />
+ <td><input type="button" class="btn btn-info" id="modepost"
+ value="Make Decision"></td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html
new file mode 100644
index 000000000..f7a3f0c5b
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Client.html
@@ -0,0 +1,153 @@
+<!--
+ ============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=========================================================
+-->
+
+<!-- http://localhost:3904/events/toApex -->
+
+<html>
+<head>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script>
+ $(document).ready(function() {
+ $("#answerspost").click(function(e) {
+ var elements = document.getElementById("answerform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "AnswerEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "text" && element.value != "") {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:3904/events/toApex",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Answers Set Successfully !!!");
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+<script>
+ $(document).ready(function() {
+ $("#modepost").click(function(e) {
+ var elements = document.getElementById("modeform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "MakeDecisionEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "radio" && element.checked) {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:3904/events/toApex",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Decision Taken: " + data.decision);
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+</head>
+<body>
+ <h3>Decision Maker Answers</h3>
+ <form name="answerform" id="answerform" method="POST">
+ <table>
+ <tr>
+ <td>First Answer:</td>
+ <td><input type="text" name="a0" value="Never Ever" /></td>
+ </tr>
+ <tr>
+ <td>Second Answer:</td>
+ <td><input type="text" name="a1" value="No" /></td>
+ </tr>
+ <tr>
+ <td>Third Answer:</td>
+ <td><input type="text" name="a2" value="Maybe not" /></td>
+ </tr>
+ <tr>
+ <td>Fourth Answer</td>
+ <td><input type="text" name="a3" value="Wait" /></td>
+ </tr>
+ <tr>
+ <td>Fifth Answer:</td>
+ <td><input type="text" name="a4" value="Maybe" /></td>
+ </tr>
+ <tr>
+ <td>Sixth Answer:</td>
+ <td><input type="text" name="a5" value="Yes" /></td>
+ </tr>
+ <tr>
+ <td>Seventh Answer:</td>
+ <td><input type="text" name="a6" value="Absolutely" /></td>
+ </tr>
+ <tr>
+ <td />
+ <td><input type="button" class="btn btn-info" id="answerspost"
+ value="Set Answers"></td>
+ </tr>
+ </table>
+ </form>
+ <h3>Decision Maker Mode</h3>
+ <form name="modeform" id="modeform" method="POST">
+ <table>
+ <tr>
+ <td><input name="mode" type="radio" value="random"
+ checked="checked">random</td>
+ <td><input name="mode" type="radio" value="pessimistic">pessimistic</td>
+ <td><input name="mode" type="radio" value="optimistic">
+ optimistic</td>
+ <td><input name="mode" type="radio" value="dithering">dithering</td>
+ </tr>
+ <tr>
+ <td />
+ <td />
+ <td />
+ <td><input type="button" class="btn btn-info" id="modepost"
+ value="Make Decision"></td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>
diff --git a/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html
new file mode 100644
index 000000000..4c8f311af
--- /dev/null
+++ b/packages/apex-pdp-package-full/src/main/package/examples/html/DecisionMaker/MakeDecision_Server.html
@@ -0,0 +1,153 @@
+<!--
+ ============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=========================================================
+-->
+
+<!-- http://localhost:23324/apex/eventInput/EventIn -->
+
+<html>
+<head>
+<script src="http://code.jquery.com/jquery-latest.js"></script>
+<script>
+ $(document).ready(function() {
+ $("#answerspost").click(function(e) {
+ var elements = document.getElementById("answerform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "AnswerEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "text" && element.value != "") {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:23324/apex/RESTConsumer/EventIn",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Answers Set Successfully !!!");
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+<script>
+ $(document).ready(function() {
+ $("#modepost").click(function(e) {
+ var elements = document.getElementById("modeform").elements;
+
+ var formValues = new Object;
+ formValues["name"] = "MakeDecisionEvent";
+ for (var i = 0, element; element = elements[i++];) {
+ if (element.type === "radio" && element.checked) {
+ formValues[element.name] = element.value;
+ }
+ }
+ console.log(formValues);
+ var stringifiedForm = JSON.stringify(formValues);
+ console.log(stringifiedForm);
+ $.ajax({
+ type : "POST",
+ url : "http://localhost:23324/apex/RESTConsumer/EventIn",
+ data : stringifiedForm,
+ crossDomain : true,
+ contentType : "application/json; charset=utf-8",
+ success : function(data) {
+ alert("Decision Taken: " + data.decision);
+ },
+ failure : function(errMsg) {
+ alert(errMsg);
+ }
+ });
+ e.preventDefault(); //STOP default action
+
+ });
+ });
+</script>
+</head>
+<body>
+ <h3>Decision Maker Answers</h3>
+ <form name="answerform" id="answerform" method="POST">
+ <table>
+ <tr>
+ <td>First Answer:</td>
+ <td><input type="text" name="a0" value="Never Ever" /></td>
+ </tr>
+ <tr>
+ <td>Second Answer:</td>
+ <td><input type="text" name="a1" value="No" /></td>
+ </tr>
+ <tr>
+ <td>Third Answer:</td>
+ <td><input type="text" name="a2" value="Maybe not" /></td>
+ </tr>
+ <tr>
+ <td>Fourth Answer</td>
+ <td><input type="text" name="a3" value="Wait" /></td>
+ </tr>
+ <tr>
+ <td>Fifth Answer:</td>
+ <td><input type="text" name="a4" value="Maybe" /></td>
+ </tr>
+ <tr>
+ <td>Sixth Answer:</td>
+ <td><input type="text" name="a5" value="Yes" /></td>
+ </tr>
+ <tr>
+ <td>Seventh Answer:</td>
+ <td><input type="text" name="a6" value="Absolutely" /></td>
+ </tr>
+ <tr>
+ <td />
+ <td><input type="button" class="btn btn-info" id="answerspost"
+ value="Set Answers"></td>
+ </tr>
+ </table>
+ </form>
+ <h3>Decision Maker Mode</h3>
+ <form name="modeform" id="modeform" method="POST">
+ <table>
+ <tr>
+ <td><input name="mode" type="radio" value="random"
+ checked="checked">random</td>
+ <td><input name="mode" type="radio" value="pessimistic">pessimistic</td>
+ <td><input name="mode" type="radio" value="optimistic">
+ optimistic</td>
+ <td><input name="mode" type="radio" value="dithering">dithering</td>
+ </tr>
+ <tr>
+ <td />
+ <td />
+ <td />
+ <td><input type="button" class="btn btn-info" id="modepost"
+ value="Make Decision"></td>
+ </tr>
+ </table>
+ </form>
+</body>
+</html>