Examples of InstanceWrapper


Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      MpContainer manager = setupContainer(prototype);
     
      assertEquals("starts with no instances", 0, manager.getProcessorCount());

      MessageOne message = new MessageOne(123);
      InstanceWrapper wrapper = manager.getInstanceForDispatch(message);
      assertEquals("instance was created", 1, manager.getProcessorCount());

      CombinedMP instance = (CombinedMP)wrapper.getInstance();
      // activation is now inline with insantiation so it's active immediately
//      assertEquals("instance not already activated", 0, instance.activationCount);
      assertEquals("instance activated", 1, instance.activationCount);
      assertEquals("instance has no existing messages", -1, instance.firstMessageTime);
//      assertNull("instance has no message list", instance.messages);
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      DummyDispatcher dispatcher = ((DummyDispatcher)manager.getDispatcher());
     
      assertEquals("starts with no instances", 0, manager.getProcessorCount());

      MessageOne message1 = new MessageOne(123);
      InstanceWrapper wrapper1 = manager.getInstanceForDispatch(message1);
      manager.dispatch(message1, false);
      CombinedMP instance = (CombinedMP)wrapper1.getInstance();

      assertEquals("instance was created", 1, manager.getProcessorCount());

      assertEquals("instance activated", 1, instance.activationCount);
      assertTrue("real activation time", instance.activationTime > 0);
      assertSame("instance received message", message1, instance.messages.get(0));
      assertEquals("message count", 1, instance.messages.size());
      assertTrue("activated before first message", instance.activationTime < instance.firstMessageTime);
      assertEquals("MessageOne",dispatcher.lastDispatched);

      MessageOne message2 = new MessageOne(123);
      InstanceWrapper wrapper2 = manager.getInstanceForDispatch(message2);
      manager.dispatch(message2, false);
      assertSame("same wrapper returned for second message", wrapper1, wrapper2);
      assertEquals("no other instance was created", 1, manager.getProcessorCount());

      assertEquals("no second activation", 1, instance.activationCount);
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      DummyDispatcher dispatcher = ((DummyDispatcher)manager.getDispatcher());

      assertEquals("starts with no instances", 0, manager.getProcessorCount());

      MessageOne message1 = new MessageOne(123);
      InstanceWrapper wrapper = manager.getInstanceForDispatch(message1);
      manager.dispatch(message1,false);
      assertEquals("instance was created", 1, manager.getProcessorCount());
      MessageOne message2 = new MessageOne(123);
      assertSame("same wrapper returned for second message",
                 wrapper, manager.getInstanceForDispatch(message2));
      manager.dispatch(message2, false);

      CombinedMP instance = (CombinedMP)wrapper.getInstance();
      assertEquals("no other instance was created", 1, manager.getProcessorCount());

      assertEquals("instance activated", 1, instance.activationCount);
      assertTrue("real activation time", instance.activationTime > 0);
      assertTrue("activated before first message", instance.activationTime < instance.firstMessageTime);
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      DummyDispatcher dispatcher = ((DummyDispatcher)manager.getDispatcher());

      assertEquals("starts with no instances", 0, manager.getProcessorCount());

      MessageOne message1 = new MessageOne(123);
      InstanceWrapper wrapper = manager.getInstanceForDispatch(message1);
      manager.dispatch(message1, true);
      CombinedMP instance = (CombinedMP)wrapper.getInstance();

      assertEquals("instance was created", 1, manager.getProcessorCount());

      assertEquals("instance activated", 1, instance.activationCount);
      assertTrue("real activation time", instance.activationTime > 0);
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      DummyDispatcher dispatcher = ((DummyDispatcher)manager.getDispatcher());

      assertEquals("starts with no instances", 0, manager.getProcessorCount());

      MessageOne message1 = new MessageOne(123);
      InstanceWrapper wrapper1 = manager.getInstanceForDispatch(message1);
      manager.dispatch(message1, true);
      CombinedMP instance1 = (CombinedMP)wrapper1.getInstance();

      MessageOne message2 = new MessageOne(456);
      InstanceWrapper wrapper2 = manager.getInstanceForDispatch(message2);
      manager.dispatch(message2, false);
      CombinedMP instance2 = (CombinedMP)wrapper2.getInstance();

      assertEquals("instances were created", 2, manager.getProcessorCount());

      assertEquals("MessageOne",dispatcher.lastDispatched);
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

      MpContainer instanceManager = setupContainer(prototype);
      DummyDispatcher dispatcher = ((DummyDispatcher)instanceManager.getDispatcher());

      // we need to dispatch messages to create MP instances
      MessageOne message1 = new MessageOne(1);
      InstanceWrapper wrapper1 = instanceManager.getInstanceForDispatch(message1);
      instanceManager.dispatch(message1, true);
      MessageOne message2 = new MessageOne(2);
      InstanceWrapper wrapper2 = instanceManager.getInstanceForDispatch(message2);
      instanceManager.dispatch(message2, true);
      assertEquals("MessageOne",dispatcher.lastDispatched);

      instanceManager.outputPass();

      OutputTestMP mp1 = (OutputTestMP)wrapper1.getInstance();
      assertTrue("MP1 output did not occur after activation", mp1.activationTime < mp1.outputTime);

      OutputTestMP mp2 = (OutputTestMP)wrapper2.getInstance();
      assertTrue("MP2 output did not occur after activation", mp2.activationTime < mp2.outputTime);
      assertTrue(mp1 != mp2);

      assertEquals(new Integer(42),dispatcher.lastDispatched);
   }
View Full Code Here

Examples of com.nokia.dempsy.container.MpContainer.InstanceWrapper

   {
      CombinedMP prototype = new CombinedMP();
      MpContainer manager = setupContainer(prototype);

      MessageOne message = new MessageOne(123);
      InstanceWrapper wrapper = manager.getInstanceForDispatch(message);
      manager.dispatch(message, false);
      assertEquals("instance was created", 1, manager.getProcessorCount());

      CombinedMP instance = (CombinedMP)wrapper.getInstance();

      assertEquals("instance activated", 1, instance.activationCount);
      assertTrue("real activation time", instance.activationTime > 0);
      assertSame("instance received message", message, instance.messages.get(0));
      assertEquals("message count", 1, instance.messages.size());
View Full Code Here

Examples of org.apache.tuscany.sca.core.context.InstanceWrapper

                        throw new IllegalArgumentException(
                                                           "Callback object for stateless callback is not a ServiceReference");
                    } else {
                        ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
                        if (scopeContainer != null) {
                            InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
                            scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
                        }
                        parameters.setCallbackObjectID(callbackObject);
                    }
                }
View Full Code Here

Examples of org.apache.tuscany.sca.core.context.InstanceWrapper

                        throw new IllegalArgumentException(
                                                           "Callback object for stateless callback is not a ServiceReference");
                    } else {
                        ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
                        if (scopeContainer != null) {
                            InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
                            scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
                        }
                        parameters.setCallbackObjectID(callbackObject);
                    }
                }
View Full Code Here

Examples of org.apache.tuscany.sca.core.context.InstanceWrapper

        }

        try {
            // The following call might create a new conversation, as a result, the msg.getConversationID() might
            // return a new value
            InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);

            // detects whether the scope container has created a conversation Id. This will
            // happen in the case that the component has conversational scope but only the
            // callback interface is conversational. Or in the callback case if the service interface
            // is conversational and the callback interface isn't. If we are in this situation we need
            // to get the contextId of this component and remove it after we have invoked the method on
            // it. It is possible that the component instance will not go away when it is removed below
            // because a callback conversation will still be holding a reference to it
            boolean removeTemporaryConversationalComponentAfterCall = false;
            if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
                contextId = parameters.getConversationID();
                removeTemporaryConversationalComponentAfterCall = true;
            }

            Object instance = wrapper.getInstance();
            Object ret;
            if (payload != null && !payload.getClass().isArray()) {
                ret = method.invoke(instance, payload);
            } else {
                ret = method.invoke(instance, (Object[])payload);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.