Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.CompositeContext.publish()


        Assert.assertNotNull(source);
        GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null);
        Assert.assertNotNull(target);
        source.getGenericComponent().setString("foo");
        Assert.assertTrue(!"foo".equals(target.getString()));
        testCtx.publish(new RequestEnd(this,id));

        //second request
        Object id2 = new Object();
        testCtx.publish(new RequestStart(this,id2));
        GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null);
View Full Code Here


        Assert.assertTrue(!"foo".equals(target.getString()));
        testCtx.publish(new RequestEnd(this,id));

        //second request
        Object id2 = new Object();
        testCtx.publish(new RequestStart(this,id2));
        GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null);
        Assert.assertNotNull(target2);
        Assert.assertTrue(!"foo".equals(target2.getString()));
       
        Assert.assertTrue(!"foo".equals(source.getGenericComponent().getString()));
View Full Code Here

        Assert.assertNotNull(ctx);
        runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test"));
        CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test");
        Assert.assertNotNull(testCtx);
        testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.SESSION));
        testCtx.publish(new ModuleStart(this));
       
        // first session
        Object session = new Object();
        Object id = new Object();
        testCtx.publish(new RequestStart(this,id));
View Full Code Here

        testCtx.publish(new ModuleStart(this));
       
        // first session
        Object session = new Object();
        Object id = new Object();
        testCtx.publish(new RequestStart(this,id));
        testCtx.publish(new HttpSessionBound(this,session));
        GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null);
        Assert.assertNotNull(target);
View Full Code Here

       
        // first session
        Object session = new Object();
        Object id = new Object();
        testCtx.publish(new RequestStart(this,id));
        testCtx.publish(new HttpSessionBound(this,session));
        GenericComponent source = (GenericComponent)testCtx.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null);
        Assert.assertNotNull(target);
        source.getGenericComponent().setString("foo");
View Full Code Here

        GenericComponent target = (GenericComponent)testCtx.getContext("target").getInstance(null);
        Assert.assertNotNull(target);
        source.getGenericComponent().setString("foo");
        source.getGenericComponent().setString("foo");
        Assert.assertEquals("foo",target.getString());
        testCtx.publish(new RequestEnd(this,id));

        //second session
        Object session2 = new Object();
        Object id2 = new Object();
        testCtx.publish(new RequestStart(this,id2));
View Full Code Here

        testCtx.publish(new RequestEnd(this,id));

        //second session
        Object session2 = new Object();
        Object id2 = new Object();
        testCtx.publish(new RequestStart(this,id2));
        testCtx.publish(new HttpSessionBound(this,session2));
        GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null);
        Assert.assertNotNull(source2);
        GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null);
View Full Code Here

        //second session
        Object session2 = new Object();
        Object id2 = new Object();
        testCtx.publish(new RequestStart(this,id2));
        testCtx.publish(new HttpSessionBound(this,session2));
        GenericComponent source2 = (GenericComponent)testCtx.getContext("source").getInstance(null);
        Assert.assertNotNull(source2);
        GenericComponent target2 = (GenericComponent)testCtx.getContext("target").getInstance(null);

        Assert.assertNotNull(target2);
View Full Code Here

        Assert.assertEquals(null,source2.getGenericComponent().getString());
        source2.getGenericComponent().setString("baz");
        Assert.assertEquals("baz",source2.getGenericComponent().getString());
        Assert.assertEquals("baz",target2.getString());
       
        testCtx.publish(new RequestEnd(this,id2));

    }

   
    /**
 
View Full Code Here

        Assert.assertNotNull(ctx);
        runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test"));
        CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test");
        Assert.assertNotNull(testCtx);
        testCtx.registerModelObject(MockFactory.createModule(Scope.SESSION,Scope.MODULE));
        testCtx.publish(new ModuleStart(this));
       
        // first session
        Object session = new Object();
        Object id = new Object();
        testCtx.publish(new RequestStart(this,id));
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.