portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From msnickl...@apache.org
Subject [1/8] portals-pluto git commit: initial merge of changes that don't imply changes to Pluto
Date Mon, 02 Feb 2015 10:35:29 GMT
Repository: portals-pluto
Updated Branches:
  refs/heads/V3Prototype acb93c676 -> 6f30042b0


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f32f7f71/portlet-api/src/test/javascript/SetPortletStateTest.js
----------------------------------------------------------------------
diff --git a/portlet-api/src/test/javascript/SetPortletStateTest.js b/portlet-api/src/test/javascript/SetPortletStateTest.js
new file mode 100644
index 0000000..0b72134
--- /dev/null
+++ b/portlet-api/src/test/javascript/SetPortletStateTest.js
@@ -0,0 +1,697 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * This is Jasmine test code for the Portlet Hub.
+ * <p>
+ * Since the portlet hub does not get reinitialized, its state is
+ * maintained throughout the testing. The tests are constructed so that
+ * by the end of module execution, any listeners that are added in the 
+ * earlier portions of the test are removed.
+ */
+
+
+describe('The portlet hub allows the portlet client to set its state.',function(){
+   'use strict'
+   
+   // get the portlet IDs provided by the system under test. The function must
+   // return a string array of portlet IDs that are known to the portlet hub being 
+   // tested. Portlets:
+   //                private parms        public parms             Render data
+   //                =============        ============             ===========
+   //    portletA      parm1, parm2             -                     -   
+   //    portletB      parm1, parm2       pubparm1                    -   
+   //    portletC      parm1, parm2       pubparm1, pubparm2          -
+   //    portletD      parm2, pubparm1    pubparm2                    -
+   //    portletE      parm1, parm2       pubparm1, pubparm2          -
+   //    portletF           -                   -                     -   
+   var portletIds = portlet.test.getIds(),                      
+       portletA = portletIds[0],                                
+       portletB = portletIds[1],                                 
+       portletC = portletIds[2],                                 
+       portletD = portletIds[3],                                 
+
+       // Test data provided by the portlet hub
+       pageState = portlet.test.getInitData(),                  
+
+
+       // Tests in thismodule need following portlets. register them.
+       // These variables provide linkage between the "describe" sections
+       hubA,
+       hubB,
+       hubC,
+       hubD;
+   
+       
+   describe('The portlet hub is initialized for the tests: ',function(){
+   
+       it('initializes a portlet hub instance for portlet A',function(){
+          var testFunc = function () {
+             return portlet.register(portletA);
+          }
+          var ph = new portlet.jasmine.PromiseHandler(testFunc);
+          runs(ph.getRun());
+          waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+          runs(ph.getChecker()); 
+          runs(function() {
+             expect(ph.result).toBeDefined();
+          }); 
+          runs(function() {
+             hubA = ph.result;
+          }); 
+       });
+       
+       it('initializes a portlet hub instance for portlet B',function(){
+          var testFunc = function () {
+             return portlet.register(portletB);
+          }
+          var ph = new portlet.jasmine.PromiseHandler(testFunc);
+          runs(ph.getRun());
+          waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+          runs(ph.getChecker()); 
+          runs(function() {
+             expect(ph.result).toBeDefined();
+          }); 
+          runs(function() {
+             hubB = ph.result;
+          }); 
+       });
+   
+       it('initializes a portlet hub instance for portlet C',function(){
+          var testFunc = function () {
+             return portlet.register(portletC);
+          }
+          var ph = new portlet.jasmine.PromiseHandler(testFunc);
+          runs(ph.getRun());
+          waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+          runs(ph.getChecker()); 
+          runs(function() {
+             expect(ph.result).toBeDefined();
+          }); 
+          runs(function() {
+             hubC = ph.result;
+          }); 
+       });
+       
+       it('initializes a portlet hub instance for portlet D',function(){
+          var testFunc = function () {
+             return portlet.register(portletD);
+          }
+          var ph = new portlet.jasmine.PromiseHandler(testFunc);
+          runs(ph.getRun());
+          waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+          runs(ph.getChecker()); 
+          runs(function() {
+             expect(ph.result).toBeDefined();
+          }); 
+          runs(function() {
+             hubD = ph.result;
+          }); 
+       });
+     
+   });
+       
+   describe('The portlet hub setPortletState function: ',function(){
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils(portletA, pageState);
+      
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+         }); 
+      });
+      
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('is present in the register return object and is a function',function(){
+         expect(typeof hubA.setPortletState).toEqual('function');
+      });
+
+      it('throws an IllegalArgumentException if no argument is provided',function(){
+         var testFunc = function () {
+            hubA.setPortletState();
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if too many (>1) arguments are provided',function(){
+         var testFunc = function () {
+            hubA.setPortletState("parm1", "parm2");
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the argument is not an object',function(){
+         var testFunc = function () {
+            hubA.setPortletState(89);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the argument is null',function(){
+         var testFunc = function () {
+            hubA.setPortletState(null);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the argument does not have a "parameters" property',function(){
+         var state = {
+               portletMode : "VIEW",
+               windowState : "NORMAL",
+         };
+         var testFunc = function () {
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the argument does not have a "windowState" property',function(){
+         var state = {
+               parameters  : {},
+               portletMode : "VIEW",
+         };
+         var testFunc = function () {
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the argument does not have a "portletMode" property',function(){
+         var state = {
+               parameters  : {},
+               windowState : "NORMAL",
+         };
+         var testFunc = function () {
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an AccessDeniedException if setPortletState is called twice',function(){
+         var state = cbA.getState();
+         var testFunc = function () {
+            hubA.setPortletState(state);
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("AccessDeniedException");
+      });
+
+      it('throws an NotInitializedException if no onStateChange listener is registered',function(){
+         var state = cbA.getState();
+         var testFunc = function () {
+            hubB.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("NotInitializedException");
+      });
+
+      it('throws an IllegalArgumentException if "windowState" has an invalid value',function(){
+         var state = cbA.getState();
+         state.windowState = "ABNORMAL";
+         var testFunc = function () {
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if "portletMode" has an invalid value',function(){
+         var state = cbA.getState();
+         state.portletMode = "ABNORMAL";
+         var testFunc = function () {
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an NotInitializedException if the portlet client has no registered onStateChange listener',function(){
+         var state = cbA.getState();
+         var testFunc = function () {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+            hubA.setPortletState(state);
+         }
+         expect(testFunc).toThrowCustomException("NotInitializedException");
+      });
+
+      it('does not throw an Exception if the argument is correct',function(){
+        var state = pageState[portletA].state;
+         runs(function() {
+            var testFunc = function () {
+               hubA.setPortletState(state);
+            }
+            expect(testFunc).not.toThrow();
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+      });
+
+      it('causes the onStateChange listener to be called',function(){
+         var state = pageState[portletA].state;
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+      });
+
+      it('allows the portlet mode to be set to "EDIT"',function(){
+         var state = cbA.getState();
+         state.portletMode = "EDIT";
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.portletMode).toEqual("EDIT");
+         }); 
+      });
+
+      it('allows the portlet mode to be set to "VIEW"',function(){
+         var state = cbA.getState();
+         state.portletMode = "VIEW";
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.portletMode).toEqual("VIEW");
+         }); 
+      });
+
+      it('allows the window state to be set to "MAXIMIZED"',function(){
+         var state = cbA.getState();
+         state.windowState = "MAXIMIZED";
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.windowState).toEqual("MAXIMIZED");
+         }); 
+      });
+
+      it('allows the window state to be set to "NORMAL"',function(){
+         var state = cbA.getState();
+         state.windowState = "NORMAL";
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.windowState).toEqual("NORMAL");
+         }); 
+      });
+
+      it('allows a new parameter "NewParm" to be set to "NewVal"',function(){
+         var state = cbA.getState();
+         state.parameters["NewParm"] = ["NewVal"];
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.parameters["NewParm"]).toEqual(["NewVal"]);
+         }); 
+      });
+
+      it('allows parameter "NewParm" to be set to ["NewVal1", "NewVal2"]',function(){
+         var state = cbA.getState();
+         var val = ["NewVal1", "NewVal2"];
+         state.parameters["NewParm"] = val;
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.parameters["NewParm"]).toEqual(val);
+         }); 
+      });
+
+      it('allows a new parameter "NewParm" to be deleted',function(){
+         var state = cbA.getState();
+         delete state.parameters["NewParm"];
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.parameters["NewParm"]).not.toEqual(["NewVal"]);
+         }); 
+      });
+
+      it('allows all parameters to be deleted',function(){
+         var state = cbA.getState();
+         state.parameters = {};
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            // count the parameters
+            var cnt = 0, parms = cbA.retPortletState.parameters;
+            for (var parm in parms) {
+               if (parms.hasOwnProperty(parm)) {
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+         }); 
+      });
+
+      it('allows several parameters to be set',function(){
+         var state = cbA.getState(),
+             newParms = {
+                  parm1 : ["Fred"],
+                  parm2 : ["Wilma", "Pebbles"],
+                  parm3 : ["Barney", "Betty", "Bam Bam"],
+               };
+         state.parameters = newParms;
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState.parameters).toEqual(hubA.newParameters(newParms));
+         }); 
+      });
+
+      it('allows setting the state back to the original test data',function(){
+         var state = cbA.getState();
+         runs(function() {
+            hubA.setPortletState(state);
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbA.retPortletState).toEqual(hubA.newState(state));
+         }); 
+      });
+
+   });
+
+      
+       
+   describe('The portlet hub setPortletState function handles public render parameters: ',function(){
+
+      // The tests in this section use three portlets that have public render parameters defined
+      var cbB = new portlet.jasmine.JasminePortletUtils(portletB, pageState);
+      var cbC = new portlet.jasmine.JasminePortletUtils(portletC, pageState);
+      var cbD = new portlet.jasmine.JasminePortletUtils(portletD, pageState);
+      
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbB.complete = false;
+         cbC.complete = false;
+         cbD.complete = false;
+         runs(function() {
+            cbB.oscHandle = hubB.addEventListener("portlet.onStateChange", cbB.getListener());
+            cbC.oscHandle = hubC.addEventListener("portlet.onStateChange", cbC.getListener());
+            cbD.oscHandle = hubD.addEventListener("portlet.onStateChange", cbD.getListener());
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbB.complete = false;    // in prep for the actual test
+            cbC.complete = false;    // in prep for the actual test
+            cbD.complete = false;    // in prep for the actual test
+         }); 
+      });
+      
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbB.oscHandle !== null) {
+            hubB.removeEventListener(cbB.oscHandle);
+            cbB.oscHandle = null;
+         }
+         if (cbC.oscHandle !== null) {
+            hubC.removeEventListener(cbC.oscHandle);
+            cbC.oscHandle = null;
+         }
+         if (cbD.oscHandle !== null) {
+            hubD.removeEventListener(cbD.oscHandle);
+            cbD.oscHandle = null;
+         }
+      });
+
+      it('throws an AccessDeniedException if called before previous set portlet state completes',function(){
+         var parms  = {rp1 : ["resVal"]};
+         var el = document.createElement("form");
+         runs(function() {
+            var state = cbB.getState();
+            state.parameters["pubparm1"] = ["NewVal"];
+            var testFunc = function () {
+               hubB.setPortletState(state);
+            }
+            expect(testFunc).not.toThrow();
+         }); 
+         runs(function() {
+            var state = cbC.getState();
+            state.parameters["someparm1"] = ["NewVal"];
+            var testFunc = function () {
+               hubC.setPortletState(state);
+            }
+            expect(testFunc).toThrowCustomException("AccessDeniedException");
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+      });
+
+      it('informs the initiating portlet (B) when public render parameter is set',function(){
+         var state = cbB.getState();
+         state.parameters["pubparm1"] = ["NewVal"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(["NewVal"]);
+         }); 
+      });
+
+      it('informs the other affected portlet (C) when public render parameter is set',function(){
+         var state = cbB.getState();
+         state.parameters["pubparm1"] = ["NewVal2"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(["NewVal2"]);
+         }); 
+      });
+
+      it('does not inform unaffected portlet (D) when public render parameter is set',function(){
+         var state = cbB.getState();
+         state.parameters["pubparm1"] = ["NewVal"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbD.isComplete()).toBeFalsy();
+         }); 
+      });
+
+      it('does not update private parameter in unaffected portlet (D) with same name as public parameter',function(){
+         var state = cbC.getState();
+         state.parameters["pubparm1"] = ["newVal4"];
+         runs(function() {
+            hubC.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbD.isComplete()).toBeFalsy();
+         }); 
+      });
+
+      it('does not update PRP when private parameter with same name as PRP is changed in different portlet',function(){
+         var state = cbD.getState();
+         state.parameters["pubparm1"] = ["NewVal5"];
+         runs(function() {
+            hubD.setPortletState(state);
+         }); 
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.isComplete()).toBeFalsy();
+            expect(cbC.isComplete()).toBeFalsy();
+            expect(cbD.retPortletState.parameters["pubparm1"]).toEqual(["NewVal5"]);
+         }); 
+      });
+
+      it('allows changing multiple PRPs and having affected portlets be notified',function(){
+         var state = cbC.getState(), prp1, prp2;
+         prp1 = state.parameters.pubparm1 = ["NewVal5", "NewVal6"];
+         prp2 = state.parameters.pubparm2 = ["NewVal7", "NewVal8"];
+         runs(function() {
+            hubC.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+            expect(cbD.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+            // pubparm1 is private parm for portletD
+            expect(cbD.retPortletState.parameters["pubparm1"]).not.toEqual(prp1);
+         }); 
+      });
+
+      it('allows a PRP to be deleted, and it is deleted for all affected portlets',function(){
+         var state = cbB.getState();
+         delete state.parameters["pubparm1"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toBeUndefined();
+            expect(cbC.retPortletState.parameters["pubparm1"]).toBeUndefined();
+         }); 
+      });
+
+      it('allows a deleted PRP to be added again',function(){
+         var state = cbB.getState();
+         state.parameters["pubparm1"] = ["NewVal2", "NewVal3"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(["NewVal2", "NewVal3"]);
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(["NewVal2", "NewVal3"]);
+            expect(cbD.isComplete()).toBeFalsy();
+         }); 
+      });
+
+      it('informs only affected portlets when a PRP is deleted',function(){
+         var state = cbB.getState();
+         delete state.parameters["pubparm1"];
+         runs(function() {
+            hubB.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbD.isComplete()).toBeFalsy();
+         }); 
+      });
+
+      it('allows a deleted PRP to be added again through a different portlet',function(){
+         var state = cbC.getState(),
+             prp1 = ["NewVal10", "NewVal11"];
+         state.parameters["pubparm1"] = prp1;
+         runs(function() {
+            hubC.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            // pubparm1 is private parameter for portlet D 
+            expect(cbD.isComplete()).toBeFalsy();
+            expect(cbD.retPortletState.parameters["pubparm1"]).not.toEqual(prp1);
+         }); 
+      });
+
+      it('allows deleting all parameters on a portlet with PRPs. All affected portlets are notified',function(){
+         var state = cbC.getState();
+         state.parameters = {};
+         runs(function() {
+            hubC.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toBeUndefined();
+            expect(cbC.retPortletState.parameters["pubparm1"]).toBeUndefined();
+            expect(cbC.retPortletState.parameters["pubparm2"]).toBeUndefined();
+            expect(cbD.retPortletState.parameters["pubparm2"]).toBeUndefined();
+            expect(cbD.retPortletState.parameters["pubparm1"]).toBeDefined();
+         }); 
+      });
+
+      it('allows adding back multiple previously deleted PRPs and having affected portlets be notified',function(){
+         var state = cbC.cloneState(pageState[portletC].state);
+         var prp1 = state.parameters.pubparm1;
+         var prp2 = state.parameters.pubparm2;
+         runs(function() {
+            hubC.setPortletState(state);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+            expect(cbD.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+            expect(cbD.retPortletState.parameters["pubparm1"]).not.toEqual(prp1);
+         }); 
+      });
+
+      it('allows setting the state back to the original test data',function(){
+         var stateB = cbB.cloneState(pageState[portletB].state),
+             stateC = cbC.cloneState(pageState[portletC].state),
+             stateD = cbD.cloneState(pageState[portletD].state),
+             prp1 = stateC.parameters.pubparm1,
+             prp2 = stateC.parameters.pubparm2;
+         
+         runs(function() {
+            hubB.setPortletState(stateB);
+         }); 
+         waitsFor(cbB.getIsComplete(), "The onStateChange callback should be called", 100);
+         
+         runs(function() {
+            hubC.setPortletState(stateC);
+         }); 
+         waitsFor(cbC.getIsComplete(), "The onStateChange callback should be called", 100);
+         
+         runs(function() {
+            hubD.setPortletState(stateD);
+         }); 
+         waitsFor(cbD.getIsComplete(), "The onStateChange callback should be called", 100);
+         
+         runs(function() {
+            expect(cbB.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm1"]).toEqual(prp1);
+            expect(cbC.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+            expect(cbD.retPortletState.parameters["pubparm2"]).toEqual(prp2);
+         }); 
+      });
+   
+   });
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f32f7f71/portlet-api/src/test/javascript/SetUpAndRegisterTest.js
----------------------------------------------------------------------
diff --git a/portlet-api/src/test/javascript/SetUpAndRegisterTest.js b/portlet-api/src/test/javascript/SetUpAndRegisterTest.js
new file mode 100644
index 0000000..dd00613
--- /dev/null
+++ b/portlet-api/src/test/javascript/SetUpAndRegisterTest.js
@@ -0,0 +1,192 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * This is Jasmine test code for the Portlet Hub.
+ */
+
+
+describe('The portlet hub provides JavaScript support for portlets.',function(){
+   'use strict'
+         
+   // get the portlet IDs provided by the system under test. The function must
+   // return a string array of portlet IDs that are known to the portlet hub being 
+   // tested. There must be at least 3 IDs available.
+   var portletIds = portlet.test.getIds(),
+       pageState = portlet.test.getInitData(),
+       portletA = portletIds[0],
+       portletB = portletIds[3],
+       portletC = portletIds[1],
+       portletE = portletIds[4],
+       portletF = portletIds[5];
+    
+   
+
+   it('provides a global namespace of "portlet"',function(){
+      expect(portlet).toBeDefined();
+   });
+
+   it('provides a property named "register" in the portlet namespace',function(){
+      expect(portlet.register).toBeDefined();
+   });
+
+   it('the register property in the portlet namespace is a function',function(){
+      expect(typeof portlet.register).toEqual('function');
+   });
+
+   
+   /**
+    * Test the portlet hub register function
+    */
+   describe('The portlet hub register function: ',function(){
+
+      it('throws an IllegalArgumentException if no portlet ID argument is provided',function(){
+         var testFunc = function () {
+            portlet.register();
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if too many (>1) arguments are provided',function(){
+         var testFunc = function () {
+            portlet.register("InvalidPortletID1", "InvalidPortletID2");
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the portlet ID is not a string',function(){
+         var testFunc = function () {
+            portlet.register(89);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the portlet ID is undefined',function(){
+         var testFunc = function () {
+            portlet.register(undefined);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('throws an IllegalArgumentException if the portlet ID is null',function(){
+         var testFunc = function () {
+            portlet.register(null);
+         }
+         expect(testFunc).toThrowCustomException("IllegalArgumentException");
+      });
+
+      it('The promise fails if the portlet ID is not defined for the portlet hub',function(){
+         var result, errString="", errFlag=false, complete=false;
+         var checkSuccess = function () {
+            return (complete || errFlag);
+         }
+         runs(function () {
+            var testFunc = function() {
+               var p = portlet.register("InvalidPortletId");
+               p.then( 
+                  function (pi) {
+                     result = pi; 
+                     complete = true;
+                  }, 
+                  function (err) {
+                     errString = err;
+                     errFlag = true;
+                  } 
+               );
+            }
+            expect(testFunc).not.toThrow();
+         });
+         waitsFor(checkSuccess, "The PortletInit object should be returned", 1000);
+         runs(function() {
+            expect(errString).not.toEqual("");
+            expect(complete).not.toBeTruthy();
+            expect(errFlag).toBeTruthy();
+         }); 
+      });
+
+      it('does not throw an exception if the portlet ID is valid',function(){
+         var testFunc = function () {
+            portlet.register(portletA);
+         }
+         expect(testFunc).not.toThrow();
+      });
+
+      it('returns an object when provided with a valid portlet ID',function(){
+         var testFunc = function () {
+            return portlet.register(portletB);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+      });
+
+      it('returns a PortletInit object containing a "portletModes" property',function(){
+         var testFunc = function () {
+            return portlet.register(portletB);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+         runs(function() {
+            expect(ph.result).toBeDefined();
+         }); 
+      });
+
+      it('returns PortletInit.portletModes equal to the test data',function(){
+         var testFunc = function () {
+            return portlet.register(portletB);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+         runs(function() {
+            expect(ph.result.portletModes).toEqual(pageState[portletB].allowedPM);
+         }); 
+      });
+
+      it('returns a PortletInit object containing a "windowStates" property',function(){
+         var testFunc = function () {
+            return portlet.register(portletB);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+         runs(function() {
+            expect(ph.result.windowStates).toBeDefined();
+         }); 
+      });
+
+      it('returns PortletInit.windowStates equal to the test data',function(){
+         var testFunc = function () {
+            return portlet.register(portletB);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+         runs(function() {
+            expect(ph.result.windowStates).toEqual(pageState[portletB].allowedWS);
+         }); 
+      });
+
+   });
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f32f7f71/portlet-api/src/test/javascript/SimulatedErrorTests.js
----------------------------------------------------------------------
diff --git a/portlet-api/src/test/javascript/SimulatedErrorTests.js b/portlet-api/src/test/javascript/SimulatedErrorTests.js
new file mode 100644
index 0000000..c61010e
--- /dev/null
+++ b/portlet-api/src/test/javascript/SimulatedErrorTests.js
@@ -0,0 +1,318 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * This is Jasmine test code for the Portlet Hub.
+ * <p>
+ * Since the portlet hub does not get reinitialized, its state is
+ * maintained throughout the testing. The tests are constructed so that
+ * by the end of module execution, any listeners that are added in the 
+ * earlier portions of the test are removed.
+ */
+
+
+describe('If the PortletHub mock implementation is present, simulated error condition specs are executed.',function(){
+   'use strict'
+
+   // get the portlet IDs provided by the system under test. The function must
+   // return a string array of portlet IDs that are known to the portlet hub being 
+   // tested. Portlets:
+   //                private parms        public parms             Render data
+   //                =============        ============             ===========
+   //    portletA      parm1, parm2             -                     -   
+   //    portletB      parm1, parm2       pubparm1                    -   
+   //    portletC      parm1, parm2       pubparm1, pubparm2          -
+   //    portletD      parm2, pubparm1    pubparm2                    -
+   //    portletE      parm1, parm2       pubparm1, pubparm2          -
+   //    portletF           -                   -                     -   
+   var portletIds = portlet.test.getIds(),                      
+   portletA = portletIds[0],                                
+   portletB = portletIds[1],                                 
+   portletC = portletIds[2],                                 
+   portletD = portletIds[3],                                 
+
+   // Test data provided by the portlet hub
+   pageState = portlet.test.getInitData(),                  
+
+
+   // Tests in this module need following portlets. register them.
+   // These variables provide linkage between the "describe" sections
+   hubA,
+   hubErr;
+       
+   // This spec can only be executed against a mock implementation that simulates
+   // the condition!!
+   if ((portletIds.indexOf('SimulateCommError') >= 0)) {
+
+      describe('The portlet hub is initialized for the tests: ',function(){
+
+         it('initializes a portlet hub instance for portlet A',function(){
+            var testFunc = function () {
+               return portlet.register(portletA);
+            }
+            var ph = new portlet.jasmine.PromiseHandler(testFunc);
+            runs(ph.getRun());
+            waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+            runs(ph.getChecker()); 
+            runs(function() {
+               expect(ph.result).toBeDefined();
+            }); 
+            runs(function() {
+               hubA = ph.result;
+            }); 
+         });
+
+         it('initializes a portlet hub instance for Error simulating portlet',function(){
+            var testFunc = function () {
+               return portlet.register('SimulateCommError');
+            }
+            var ph = new portlet.jasmine.PromiseHandler(testFunc);
+            runs(ph.getRun());
+            waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+            runs(ph.getChecker()); 
+            runs(function() {
+               expect(ph.result).toBeDefined();
+            }); 
+            runs(function() {
+               hubErr = ph.result;
+            }); 
+         });
+
+      });
+
+      
+      describe('The portlet hub reports error if promise is rejected: ',function(){
+
+         // The tests in this section use just a single portlet - portletA
+         var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState);
+
+         // add an osc handler for the test
+         beforeEach(function () {
+            cbA.complete = false;
+            runs(function() {
+               cbA.oscHandle = hubErr.addEventListener("portlet.onStateChange", cbA.getListener());
+            }); 
+            waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               cbA.complete = false;    // in prep for the actual test
+            }); 
+         });
+
+         // remove the osc handler added during the test
+         afterEach(function () {
+            if (cbA.oscHandle !== null) {
+               hubErr.removeEventListener(cbA.oscHandle);
+               cbA.oscHandle = null;
+            }
+         });
+
+
+         it('register method supports an asynchronous response from the impl',function(){
+            var testFunc = function () {
+               return portlet.register('SimulateLongWait');
+            }
+            var ph = new portlet.jasmine.PromiseHandler(testFunc);
+            runs(ph.getRun());
+            waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+            runs(ph.getChecker()); 
+         });
+
+         it('register method rejects the promise if an error occurs',function(){
+            var testFunc = function () {
+               return portlet.register('SimulateError');
+            }
+            var ph = new portlet.jasmine.PromiseHandler(testFunc);
+            runs(ph.getRun());
+            waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+            runs(function() {
+               expect(ph.errMsg).not.toEqual("");
+               expect(ph.complete).not.toBeTruthy();
+               expect(ph.error).toBeTruthy();
+            }); 
+         });
+
+         it('createResourceUrl does not cause the failure method to be called when no error occurs',function(){
+            var parms  = {rp1 : ["resVal"], rp2 : ["resVal2"]}, 
+            cache="cacheLevelPage", url = null, errmsg = null;
+            runs(function() {
+               hubErr.createResourceUrl(parms, cache).then(function (u) {
+                  url = u;
+               }, function (err) {
+                  errmsg = err;
+               });
+            }); 
+            waitsFor(function () {return ((url !== null) || (errmsg !== null));}, "The promise to settle", 100)
+            runs(function() {
+               expect(errmsg).toEqual(null);
+               expect(portlet.test.resource.isResourceUrl(url)).toBeTruthy();
+            }); 
+         });
+
+         it('createResourceUrl rejects the promise when an error occurs',function(){
+            var parms  = {SimulateError : ["reject"], rp2 : ["resVal2"]}, 
+            cache="cacheLevelPage", url = null, errmsg = null;
+            runs(function() {
+               hubErr.createResourceUrl(parms, cache).then(function (u) {
+                  url = u;
+               }, function (err) {
+                  errmsg = err;
+               });
+            }); 
+            waitsFor(function () {return ((url !== null) || (errmsg !== null));}, "The promise to settle", 100)
+            runs(function() {
+               expect(url).toEqual(null);
+               expect(errmsg).not.toEqual(null);
+            }); 
+         });
+
+         it('startPartialAction does not cause the failure method to be called when no error occurs',function(){
+            var parms  = {}, pai = null, errmsg = null;
+            var ustr = portlet.test.data.updateStrings[portletA]; // doesn't matter what update data to use
+            runs(function() {
+               hubErr.startPartialAction(parms).then(function (p) {
+                  pai = p;
+               }, function (err) {
+                  errmsg = err;
+               });
+            }); 
+            waitsFor(function () {return ((pai !== null) || (errmsg !== null));}, "The promise to settle", 100)
+            if (pai !== null){
+               runs(function() {
+                  pai.setPageState(ustr);
+               }); 
+            }
+            runs(function() {
+               expect(pai).not.toEqual(null);
+               expect(errmsg).toEqual(null);
+            }); 
+         });
+
+         it('startPartialAction rejects the promise when an error occurs',function(){
+            var parms  = {SimulateError : ["reject"]}, pai = null, errmsg = null;
+            var ustr = portlet.test.data.updateStrings[portletA]; // doesn't matter what update data to use
+            runs(function() {
+               hubErr.startPartialAction(parms).then(function (p) {
+                  pai = p;
+               }, function (err) {
+                  errmsg = err;
+               });
+            }); 
+            waitsFor(function () {return ((pai !== null) || (errmsg !== null));}, "The promise to settle", 100)
+            if (pai !== null){
+               runs(function() {
+                  pai.setPageState(ustr);
+               }); 
+            }
+            runs(function() {
+               expect(pai).toEqual(null);
+               expect(errmsg).not.toEqual(null);
+            }); 
+         });
+
+      });
+
+
+      describe('The portlet hub fires onError event if async error occurs during an action or while setting state: ',function(){
+
+         // The tests in this section use just a single portlet - portletA
+         var cbErr = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState);
+
+         // add an osc handler for the test
+         beforeEach(function () {
+            cbErr.complete = false;
+            runs(function() {
+               cbErr.oscHandle = hubErr.addEventListener("portlet.onStateChange", cbErr.getListener());
+               cbErr.oeHandle = hubErr.addEventListener("portlet.onError", cbErr.getListener("error"));
+            }); 
+            waitsFor(cbErr.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               cbErr.complete = false;    // in prep for the actual test
+               cbErr.retType = null;
+               cbErr.retErrorData = null;
+            }); 
+         });
+
+         // remove the osc handler added during the test
+         afterEach(function () {
+            if (cbErr.oscHandle !== null) {
+               hubErr.removeEventListener(cbErr.oscHandle);
+               cbErr.oscHandle = null;
+            }
+            if (cbErr.oeHandle !== null) {
+               hubErr.removeEventListener(cbErr.oeHandle);
+               cbErr.oeHandle = null;
+            }
+         });
+
+         it('The onError function is not called if no error occurs setting state',function(){
+            var state = cbErr.getState();
+            state.parameters["NewParm"] = ["NewVal"];
+            runs(function() {
+               hubErr.setPortletState(state);
+            }); 
+            waitsFor(cbErr.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               expect(cbErr.retType).not.toEqual('portlet.onError');
+               expect(cbErr.retPortletState).not.toEqual(null);
+               expect(cbErr.retErrorData).toEqual(null);
+               expect(cbErr.retPortletState.parameters["NewParm"]).toEqual(["NewVal"]);
+            }); 
+         });
+
+         it('The onError function is called if an asynch error occurs setting state',function(){
+            var state = cbErr.getState();
+            state.parameters["SimulateError"] = ["reject"];
+            runs(function() {
+               hubErr.setPortletState(state);
+            }); 
+            waitsFor(cbErr.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               expect(cbErr.retType).toEqual('portlet.onError');
+               expect(cbErr.retErrorData).not.toEqual(null);
+            }); 
+         });
+
+         it('The onError function is not called if no error occurs performing action',function(){
+            var parms  = {};
+            runs(function() {
+               hubErr.action(parms);
+            }); 
+            waitsFor(cbErr.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               expect(cbErr.retType).not.toEqual('portlet.onError');
+               expect(cbErr.retPortletState).not.toEqual(null);
+               expect(cbErr.retErrorData).toEqual(null);
+            }); 
+         });
+
+         it('The onError function is called if an asynch error occurs performing action',function(){
+            var parms  = {SimulateError : ["reject"]};
+            runs(function() {
+               hubErr.action(parms);
+            }); 
+            waitsFor(cbErr.getIsComplete(), "The onStateChange callback should be called", 100);
+            runs(function() {
+               expect(cbErr.retType).toEqual('portlet.onError');
+               expect(cbErr.retErrorData).not.toEqual(null);
+            }); 
+         });
+
+      });
+
+   }
+});

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f32f7f71/portlet-api/src/test/javascript/StateTests.js
----------------------------------------------------------------------
diff --git a/portlet-api/src/test/javascript/StateTests.js b/portlet-api/src/test/javascript/StateTests.js
new file mode 100644
index 0000000..aa1db43
--- /dev/null
+++ b/portlet-api/src/test/javascript/StateTests.js
@@ -0,0 +1,758 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * This is Jasmine test code for the Portlet Hub.
+ * <p>
+ * Since the portlet hub does not get reinitialized, its state is
+ * maintained throughout the testing. The tests are constructed so that
+ * by the end of module execution, any listeners that are added in the 
+ * earlier portions of the test are removed.
+ */
+
+
+describe('The Portlet Hub provides accessor functions for the portlet state and parameters.',function(){
+   'use strict'
+
+   // get the portlet IDs provided by the system under test. The function must
+   // return a string array of portlet IDs that are known to the portlet hub being 
+   // tested. Portlets:
+   //                private parms        public parms             Render data
+   //                =============        ============             ===========
+   //    portletA      parm1, parm2             -                     -   
+   //    portletB      parm1, parm2       pubparm1                    -   
+   //    portletC      parm1, parm2       pubparm1, pubparm2          -
+   //    portletD      parm2, pubparm1    pubparm2                    -
+   //    portletE      parm1, parm2       pubparm1, pubparm2          -
+   //    portletF           -                   -                     -   
+   var portletIds = portlet.test.getIds(),                      
+   portletA = portletIds[0],                                
+   portletB = portletIds[1],                                 
+   portletC = portletIds[2],                                 
+   portletD = portletIds[3],                                 
+
+   // Test data provided by the portlet hub
+   pageState = portlet.test.getInitData(),                  
+
+
+   // Tests in this module need following portlets. register them.
+   // These variables provide linkage between the "describe" sections
+   hubA;
+
+   describe('The portlet hub is initialized for the tests: ',function(){
+
+      it('initializes a portlet hub instance for portlet A',function(){
+         var testFunc = function () {
+            return portlet.register(portletA);
+         }
+         var ph = new portlet.jasmine.PromiseHandler(testFunc);
+         runs(ph.getRun());
+         waitsFor(ph.getIsComplete(), "The PortletInit object should be returned", 1000);
+         runs(ph.getChecker()); 
+         runs(function() {
+            expect(ph.result).toBeDefined();
+         }); 
+         runs(function() {
+            hubA = ph.result;
+         }); 
+      });
+
+   });
+
+   
+   describe('The portlet hub newParameters function: ', function () {
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState);
+
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+         }); 
+      });
+
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('is present in the register return object and is a function', function () {
+         expect(typeof hubA.newParameters).toEqual('function');
+      });
+
+      it('returns a Parameters object containing the required functions', function () {
+         var p;
+         runs(function() {
+            p = hubA.newParameters();
+            expect(typeof p).toEqual('object');
+            expect(typeof p.clone).toEqual('function');
+            expect(typeof p.setValue).toEqual('function');
+            expect(typeof p.setValues).toEqual('function');
+            expect(typeof p.getValue).toEqual('function');
+            expect(typeof p.getValues).toEqual('function');
+            expect(typeof p.remove).toEqual('function');
+         }); 
+      });
+
+      it('returns a Parameters object containing no parameters', function () {
+         var p, key, cnt = 0;
+         runs(function() {
+            p = hubA.newParameters();
+            for (key in p) {
+               expect(p.hasOwnProperty(key)).toEqual(false);
+               if (p.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+         }); 
+      });
+
+      it('returns a Parameters object containing no parameters', function () {
+         var p, key, cnt = 0;
+         runs(function() {
+            p = hubA.newParameters();
+            for (key in p) {
+               expect(p.hasOwnProperty(key)).toEqual(false);
+               if (p.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+         }); 
+      });
+
+      it('returns a Parameters object containing the parameters if passed a parameters object', function () {
+         var parms = {parm1: ['fred'], parm2: ['barney']}, p, key, cnt = 0;
+         runs(function() {
+            p = hubA.newParameters(parms);
+            for (key in p) {
+               if (p.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(p.parm1).toEqual(['fred']);
+            expect(p.parm2).toEqual(['barney']);
+         }); 
+      });
+
+   });
+
+   
+   describe('The returned parameters object: ', function () {
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState),
+      parms = null;
+
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+            parms = null;
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+            parms = hubA.newParameters();
+         }); 
+      });
+
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('allows parameters to be set', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parms.setValue('parm2', parm2)
+            for (key in parms) {
+               if (parms.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(parms.parm1).toEqual(parm1);
+            expect(parms.parm2).toEqual(parm2);
+         }); 
+      });
+
+      it('setting a parameter of the same name replaces the old  parameter value', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parms.setValue('parm1', parm2)
+            for (key in parms) {
+               if (parms.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(1);
+            expect(parms.parm1).toEqual(parm2);
+         }); 
+      });
+
+      it('allows reading a single-value parameter that was set', function () {
+         var parm1 = ['fred'], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parm2 = parms.getValue('parm1');
+            expect(parm2).toEqual(parm1[0]);
+         }); 
+      });
+
+      it('allows reading a single-value parameter when a default value is provided', function () {
+         var parm1 = ['fred'], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parm2 = parms.getValue('parm1', 'defaultVal');
+            expect(parm2).toEqual(parm1[0]);
+         }); 
+      });
+
+      it('allows reading a single-value parameter that was set to null', function () {
+         var parm1 = [null], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parm2 = parms.getValue('parm1', 'defaultVal');
+            expect(parm2).toBeNull();
+         }); 
+      });
+
+      it('allows removing a single-value parameter that was set', function () {
+         var parm1 = ['fred'], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parms.remove('parm1');
+            parm2 = parms.getValue('parm1');
+            expect(parm2).toBeUndefined();
+            expect(parms.parm1).toBeUndefined();
+         }); 
+      });
+
+      it('returns undefined when reading an undefined single-value parameter without a default', function () {
+         var parm2;
+         runs(function() {
+            parm2 = parms.getValue('parm1');
+            expect(parm2).toBeUndefined();
+         }); 
+      });
+
+      it('returns the default value when reading an undefined single-value parameter with a default', function () {
+         var parm2;
+         runs(function() {
+            parm2 = parms.getValue('parm1', 'defaultValue');
+            expect(parm2).toEqual('defaultValue');
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            parms.parm1 = parm1;
+            parm2 = parms.getValues('parm1', ['defaultVal1', 'defaultVal2']);
+            expect(parm2).toEqual(parm1);
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set through setValues', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            parms.setValues('parm1', parm1)
+            parm2 = parms.getValues('parm1');
+            expect(parm2).toEqual(parm1);
+         }); 
+      });
+
+      it('allows reading a multi-value parameter when a default value array is provided', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            parms.setValues('parm1', parm1)
+            parm2 = parms.getValues('parm1', ['defVal1', 'defVal2']);
+            expect(parm2).toEqual(parm1);
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set to null', function () {
+         var parm1 = ['fred', null], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parm2 = parms.getValues('parm1');
+            expect(parm2).toEqual(parm1);
+            expect(parm2[0]).toEqual('fred');
+            expect(parm2[1]).toEqual(null);
+         }); 
+      });
+
+      it('allows removing a multi-value parameter that was set', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parms.remove('parm1');
+            parm2 = parms.getValue('parm1');
+            expect(parm2).toBeUndefined();
+            expect(parms.parm1).toBeUndefined();
+         }); 
+      });
+
+      it('returns undefined when reading an undefined multi-value parameter without a default', function () {
+         var parm2;
+         runs(function() {
+            parm2 = parms.getValues('parm1');
+            expect(parm2).toBeUndefined();
+         }); 
+      });
+
+      it('returns the default value when reading an undefined multi-value parameter with a default', function () {
+         var parm2;
+         runs(function() {
+            parm2 = parms.getValues('parm1', ['defaultVal1', 'defaultVal2']);
+            expect(parm2).toEqual(['defaultVal1', 'defaultVal2']);
+         }); 
+      });
+
+      it('can be cloned if empty', function () {
+         var p2, key, cnt = 0;
+         runs(function() {
+            p2 = parms.clone();
+            for (key in p2) {
+               if (parms.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+            expect(typeof p2).toEqual('object');
+            expect(typeof p2.clone).toEqual('function');
+            expect(typeof p2.setValue).toEqual('function');
+            expect(typeof p2.getValue).toEqual('function');
+            expect(typeof p2.getValues).toEqual('function');
+            expect(typeof p2.remove).toEqual('function');
+        }); 
+      });
+
+      it('can be cloned if parameters are set', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0, p2;
+         runs(function() {
+            parms.setValue('parm1', parm1)
+            parms.setValue('parm2', parm2)
+            p2 = parms.clone();
+            for (key in p2) {
+               if (parms.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(typeof p2).toEqual('object');
+            expect(typeof p2.clone).toEqual('function');
+            expect(typeof p2.setValue).toEqual('function');
+            expect(typeof p2.setValues).toEqual('function');
+            expect(typeof p2.getValue).toEqual('function');
+            expect(typeof p2.getValues).toEqual('function');
+            expect(typeof p2.remove).toEqual('function');
+            expect(p2.parm1).toEqual(parm1);
+            expect(p2.parm2).toEqual(parm2);
+         }); 
+      });
+   });
+
+   
+   describe('The portlet hub newState function: ', function () {
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState);
+
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+         }); 
+      });
+
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('is present in the register return object and is a function', function () {
+         expect(typeof hubA.newState).toEqual('function');
+      });
+
+      it('returns a State object containing the required functions and fields', function () {
+         var s;
+         runs(function() {
+            s = hubA.newState();
+            expect(typeof s).toEqual('object');
+            expect(typeof s.clone).toEqual('function');
+            expect(typeof s.setPortletMode).toEqual('function');
+            expect(typeof s.getPortletMode).toEqual('function');
+            expect(typeof s.setWindowState).toEqual('function');
+            expect(typeof s.getWindowState).toEqual('function');
+            expect(typeof s.parameters).toEqual('object');
+            expect(typeof s.p).toEqual('object');
+            expect(s.p).toEqual(s.parameters);
+            expect(typeof s.portletMode).toEqual('string');
+            expect(typeof s.windowState).toEqual('string');
+         }); 
+      });
+
+      it('returns a State object containing no parameters', function () {
+         var s, key, cnt = 0;
+         runs(function() {
+            s = hubA.newState();
+            for (key in s.parameters) {
+               expect(s.parameters.hasOwnProperty(key)).toEqual(false);
+               if (s.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+         }); 
+      });
+
+      it('returns a State object containing cloned values if passed a State object', function () {
+         var state = {parameters: {parm1: ['fred'], parm2: ['barney']}, portletMode:'EDIT', windowState: 'MINIMIZED'}, 
+                     s, key, cnt = 0;
+         runs(function() {
+            s = hubA.newState(state);
+            for (key in s.parameters) {
+               if (s.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(s.parameters.parm1).toEqual(['fred']);
+            expect(s.parameters.parm2).toEqual(['barney']);
+            expect(s.portletMode).toEqual('EDIT');
+            expect(s.windowState).toEqual('MINIMIZED');
+         }); 
+      });
+
+   });
+
+   
+   describe('The returned State object: ', function () {
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState),
+      state = null;
+
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+            state = null;
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+            state = hubA.newState();
+         }); 
+      });
+
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('allows parameters to be set', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            state.parameters.setValue('parm2', parm2)
+            for (key in state.parameters) {
+               if (state.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(state.parameters.parm1).toEqual(parm1);
+            expect(state.parameters.parm2).toEqual(parm2);
+         }); 
+      });
+
+      it('has a shortcut p to access the parameters', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0;
+         runs(function() {
+            state.p.setValue('parm1', parm1)
+            state.p.setValue('parm2', parm2)
+            for (key in state.p) {
+               if (state.p.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(state.p.parm1).toEqual(parm1);
+            expect(state.p.parm2).toEqual(parm2);
+         }); 
+      });
+
+      it('setting a parameter of the same name replaces the old  parameter value', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            state.parameters.setValue('parm1', parm2)
+            for (key in state.parameters) {
+               if (state.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(1);
+            expect(state.parameters.parm1).toEqual(parm2);
+         }); 
+      });
+
+      it('allows reading a single-value parameter that was set', function () {
+         var parm1 = ['fred'], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            parm2 = state.parameters.getValue('parm1');
+            expect(parm2).toEqual(parm1[0]);
+         }); 
+      });
+
+      it('allows reading a single-value parameter that was set to null', function () {
+         var parm1 = [null], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            parm2 = state.parameters.getValue('parm1');
+            expect(parm2).toBeNull();
+         }); 
+      });
+
+      it('allows removing a single-value parameter that was set', function () {
+         var parm1 = ['fred'], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            state.parameters.remove('parm1');
+            parm2 = state.parameters.getValue('parm1');
+            expect(parm2).toBeUndefined();
+            expect(state.parameters.parm1).toBeUndefined();
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            parm2 = state.parameters.getValues('parm1');
+            expect(parm2).toEqual(parm1);
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set through the shortcut p', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            state.p.setValue('parm1', parm1)
+            parm2 = state.p.getValues('parm1');
+            expect(parm2).toEqual(parm1);
+         }); 
+      });
+
+      it('allows reading a multi-value parameter that was set to null', function () {
+         var parm1 = ['fred', null], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            parm2 = state.parameters.getValues('parm1');
+            expect(parm2).toEqual(parm1);
+            expect(parm2[0]).toEqual('fred');
+            expect(parm2[1]).toEqual(null);
+         }); 
+      });
+
+      it('allows removing a multi-value parameter that was set', function () {
+         var parm1 = ['fred', 'barney'], parm2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            state.parameters.remove('parm1');
+            parm2 = state.parameters.getValue('parm1');
+            expect(parm2).toBeUndefined();
+            expect(state.parameters.parm1).toBeUndefined();
+         }); 
+      });
+
+      it('returns undefined when getValue reads a parameter that was not set', function () {
+         var parm1;
+         runs(function() {
+            parm1 = state.parameters.getValue('parm1');
+            expect(parm1).toBeUndefined();
+         }); 
+      });
+
+      it('returns undefined when getValues reads a parameter that was not set', function () {
+         var parm1;
+         runs(function() {
+            parm1 = state.parameters.getValues('parm1');
+            expect(parm1).toBeUndefined();
+         }); 
+      });
+
+      it('can be cloned if empty', function () {
+         var p2, key, cnt = 0;
+         runs(function() {
+            p2 = state.parameters.clone();
+            for (key in p2) {
+               if (state.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(0);
+            expect(typeof p2).toEqual('object');
+            expect(typeof p2.clone).toEqual('function');
+            expect(typeof p2.setValue).toEqual('function');
+            expect(typeof p2.getValue).toEqual('function');
+            expect(typeof p2.getValues).toEqual('function');
+            expect(typeof p2.remove).toEqual('function');
+        }); 
+      });
+
+      it('can be cloned if parameters are set', function () {
+         var parm1 = ['fred'], parm2 = ['barney'], key, cnt = 0, p2;
+         runs(function() {
+            state.parameters.setValue('parm1', parm1)
+            state.parameters.setValue('parm2', parm2)
+            p2 = state.parameters.clone();
+            for (key in p2) {
+               if (state.parameters.hasOwnProperty(key)){
+                  cnt++;
+               }
+            }
+            expect(cnt).toEqual(2);
+            expect(typeof p2).toEqual('object');
+            expect(typeof p2.clone).toEqual('function');
+            expect(typeof p2.setValue).toEqual('function');
+            expect(typeof p2.getValue).toEqual('function');
+            expect(typeof p2.getValues).toEqual('function');
+            expect(typeof p2.remove).toEqual('function');
+            expect(p2.parm1).toEqual(parm1);
+            expect(p2.parm2).toEqual(parm2);
+         }); 
+      });
+
+      it('allows setting and getting the portlet mode', function () {
+         var pm = 'EDIT', pm2;
+         runs(function() {
+            state.setPortletMode(pm)
+            pm2 = state.getPortletMode();
+            expect(state.portletMode).toEqual(pm);
+            expect(pm2).toEqual(pm);
+         }); 
+      });
+
+      it('allows setting and getting the window state', function () {
+         var ws = 'MAXIMIZED', ws2;
+         runs(function() {
+            state.setWindowState(ws)
+            ws2 = state.getWindowState();
+            expect(state.windowState).toEqual(ws);
+            expect(ws2).toEqual(ws);
+         }); 
+      });
+   });
+
+   
+   describe('The Constants object: ', function () {
+
+      // The tests in this section use just a single portlet - portletA
+      var cbA = new portlet.jasmine.JasminePortletUtils('SimulateCommError', pageState),
+      cons = null;
+
+      // add an osc handler for the test
+      beforeEach(function () {
+         cbA.complete = false;
+         runs(function() {
+            cbA.oscHandle = hubA.addEventListener("portlet.onStateChange", cbA.getListener());
+            cons = null;
+         }); 
+         waitsFor(cbA.getIsComplete(), "The onStateChange callback should be called", 100);
+         runs(function() {
+            cbA.complete = false;    // in prep for the actual test
+            cons = hubA.constants;
+         }); 
+      });
+
+      // remove the osc handler added during the test
+      afterEach(function () {
+         if (cbA.oscHandle !== null) {
+            hubA.removeEventListener(cbA.oscHandle);
+            cbA.oscHandle = null;
+         }
+      });
+
+      it('contains constants for the portlet mode', function () {
+         runs(function() {
+            expect(typeof cons.VIEW).toEqual('string');
+            expect(typeof cons.EDIT).toEqual('string');
+            expect(typeof cons.HELP).toEqual('string');
+            expect(cons.VIEW).toEqual('VIEW');
+            expect(cons.EDIT).toEqual('EDIT');
+            expect(cons.HELP).toEqual('HELP');
+         }); 
+      });
+
+      it('contains constants for the window state', function () {
+         runs(function() {
+            expect(typeof cons.NORMAL).toEqual('string');
+            expect(typeof cons.MINIMIZED).toEqual('string');
+            expect(typeof cons.MAXIMIZED).toEqual('string');
+            expect(cons.NORMAL).toEqual('NORMAL');
+            expect(cons.MINIMIZED).toEqual('MINIMIZED');
+            expect(cons.MAXIMIZED).toEqual('MAXIMIZED');
+         }); 
+      });
+
+      it('contains constants for the resource URL cacheability setting', function () {
+         runs(function() {
+            expect(typeof cons.FULL).toEqual('string');
+            expect(typeof cons.PORTLET).toEqual('string');
+            expect(typeof cons.PAGE).toEqual('string');
+            expect(cons.FULL).toEqual('cacheLevelFull');
+            expect(cons.PORTLET).toEqual('cacheLevelPortlet');
+            expect(cons.PAGE).toEqual('cacheLevelPage');
+         }); 
+      });
+   });
+
+});

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f32f7f71/portlet-api/src/test/javascript/promise-6.0.0.min.js
----------------------------------------------------------------------
diff --git a/portlet-api/src/test/javascript/promise-6.0.0.min.js b/portlet-api/src/test/javascript/promise-6.0.0.min.js
new file mode 100644
index 0000000..24942ee
--- /dev/null
+++ b/portlet-api/src/test/javascript/promise-6.0.0.min.js
@@ -0,0 +1,2 @@
+!function n(t,e,o){function i(u,f){if(!e[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(r)return r(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var a=e[u]={exports:{}};t[u][0].call(a.exports,function(n){var e=t[u][1][n];return i(e?e:n)},a,a.exports,n,t,e,o)}return e[u].exports}for(var r="function"==typeof require&&require,u=0;u<o.length;u++)i(o[u]);return i}({1:[function(n,t){function e(){}var o=t.exports={};o.nextTick=function(){var n="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(n)return function(n){return window.setImmediate(n)};if(t){var e=[];return window.addEventListener("message",function(n){var t=n.source;if((t===window||null===t)&&"process-tick"===n.data&&(n.stopPropagation(),e.length>0)){var o=e.shift();o()}},!0),function(n){e.push(n),window.postMessage("process-tick","*")}}return function(n){setTimeout(n,0)}}(),o.title
 ="browser",o.browser=!0,o.env={},o.argv=[],o.on=e,o.addListener=e,o.once=e,o.off=e,o.removeListener=e,o.removeAllListeners=e,o.emit=e,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")}},{}],2:[function(n,t){"use strict";function e(n){function t(n){return null===c?void a.push(n):void r(function(){var t=c?n.onFulfilled:n.onRejected;if(null===t)return void(c?n.resolve:n.reject)(s);var e;try{e=t(s)}catch(o){return void n.reject(o)}n.resolve(e)})}function e(n){try{if(n===l)throw new TypeError("A promise cannot be resolved with itself.");if(n&&("object"==typeof n||"function"==typeof n)){var t=n.then;if("function"==typeof t)return void i(t.bind(n),e,u)}c=!0,s=n,f()}catch(o){u(o)}}function u(n){c=!1,s=n,f()}function f(){for(var n=0,e=a.length;e>n;n++)t(a[n]);a=null}if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof n
 )throw new TypeError("not a function");var c=null,s=null,a=[],l=this;this.then=function(n,e){return new l.constructor(function(i,r){t(new o(n,e,i,r))})},i(n,e,u)}function o(n,t,e,o){this.onFulfilled="function"==typeof n?n:null,this.onRejected="function"==typeof t?t:null,this.resolve=e,this.reject=o}function i(n,t,e){var o=!1;try{n(function(n){o||(o=!0,t(n))},function(n){o||(o=!0,e(n))})}catch(i){if(o)return;o=!0,e(i)}}var r=n("asap");t.exports=e},{asap:4}],3:[function(n,t){"use strict";function e(n){this.then=function(t){return"function"!=typeof t?this:new o(function(e,o){i(function(){try{e(t(n))}catch(i){o(i)}})})}}var o=n("./core.js"),i=n("asap");t.exports=o,e.prototype=o.prototype;var r=new e(!0),u=new e(!1),f=new e(null),c=new e(void 0),s=new e(0),a=new e("");o.resolve=function(n){if(n instanceof o)return n;if(null===n)return f;if(void 0===n)return c;if(n===!0)return r;if(n===!1)return u;if(0===n)return s;if(""===n)return a;if("object"==typeof n||"function"==typeof n)try{var t=n
 .then;if("function"==typeof t)return new o(t.bind(n))}catch(i){return new o(function(n,t){t(i)})}return new e(n)},o.all=function(n){var t=Array.prototype.slice.call(n);return new o(function(n,e){function o(r,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var f=u.then;if("function"==typeof f)return void f.call(u,function(n){o(r,n)},e)}t[r]=u,0===--i&&n(t)}catch(c){e(c)}}if(0===t.length)return n([]);for(var i=t.length,r=0;r<t.length;r++)o(r,t[r])})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(n){return new o(function(t,e){n.forEach(function(n){o.resolve(n).then(t,e)})})},o.prototype["catch"]=function(n){return this.then(null,n)}},{"./core.js":2,asap:4}],4:[function(n,t){(function(n){function e(){for(;i.next;){i=i.next;var n=i.task;i.task=void 0;var t=i.domain;t&&(i.domain=void 0,t.enter());try{n()}catch(o){if(c)throw t&&t.exit(),setTimeout(e,0),t&&t.enter(),o;setTimeout(function(){throw o},0)}t&&t.exit()}u=!1}function o(t){r=r.next={task:t,domain:
 c&&n.domain,next:null},u||(u=!0,f())}var i={task:void 0,next:null},r=i,u=!1,f=void 0,c=!1;if("undefined"!=typeof n&&n.nextTick)c=!0,f=function(){n.nextTick(e)};else if("function"==typeof setImmediate)f="undefined"!=typeof window?setImmediate.bind(window,e):function(){setImmediate(e)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=e,f=function(){s.port2.postMessage(0)}}else f=function(){setTimeout(e,0)};t.exports=o}).call(this,n("_process"))},{_process:1}],5:[function(){"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(){var n=arguments.length?this.then.apply(this,arguments):this;n.then(null,function(n){setTimeout(function(){throw n},0)})})},{}],6:[function(n){n("asap");"undefined"==typeof Promise&&(Promise=n("./lib/core.js"),n("./lib/es6-extensions.js")),n("./polyfill-done.js")},{"./lib/core.js":2,"./lib/es6-extensions.js":3,"./polyfill-done.js":5,asap:4}]},{},[6]);
+//# sourceMappingURL=/polyfills/promise-6.0.0.min.js.map
\ No newline at end of file


Mime
View raw message