Examples of RuntimeComponent


Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

     * </pre>
     * @param context
     * @return the current work context for the thread; this must be restored after the invocation is made
     */
    public static RuntimeComponent setRuntimeComponent(RuntimeComponent runtimeComponent) {
        RuntimeComponent old = CONTEXT.get();
        CONTEXT.set(runtimeComponent);
        return old;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    static <B> ServiceReference<B> dynamicReference(Class<B> businessInterface, Binding binding, AssemblyFactory assemblyFactory, CompositeActivator compositeActivator) {
        try {
   
            Composite composite = assemblyFactory.createComposite();
            composite.setName(new QName("http://tempuri.org", "default"));
            RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
            component.setName("default");
            component.setURI("default");
            compositeActivator.configureComponentContext(component);
            composite.getComponents().add(component);
            RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
            reference.setName("default");
            JavaInterfaceFactory javaInterfaceFactory = compositeActivator.getJavaInterfaceFactory();
            InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
            interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
            reference.setInterfaceContract(interfaceContract);
            component.getReferences().add(reference);
            reference.setComponent(component);
            reference.getBindings().add(binding);
   
            ProxyFactory proxyFactory = compositeActivator.getProxyFactory();
            return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testEviction() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        store.insertRecord(component, id, value, 1);
        Thread.sleep(200);
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

        EasyMock.replay(listener);
        MemoryStore store = new MemoryStore(monitor);
        store.addListener(listener);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        store.insertRecord(component, id, value, 1);
        if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testNoEviction() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        store.insertRecord(component, id, value, Store.NEVER);
        Thread.sleep(100);
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testInsertRecord() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        store.insertRecord(component, id, value, Store.NEVER);
        store.destroy();
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testInsertAlreadyExists() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createMock(RuntimeComponent.class);
        EasyMock.expect(component.getURI()).andReturn("component");
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        store.insertRecord(component, id, value, Store.NEVER);
        try {
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testUpdateRecord() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();
        Object newValue = new Object();
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    public void testDeleteRecord() throws Exception {
        MemoryStore store = new MemoryStore(monitor);
        store.setReaperInterval(10);
        store.init();
        RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
        EasyMock.replay(component);
        String id = UUID.randomUUID().toString();
        Object value = new Object();

        store.insertRecord(component, id, value, Store.NEVER);
View Full Code Here

Examples of org.apache.tuscany.sca.runtime.RuntimeComponent

    /**
     * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#read(java.io.Reader)
     */
    public RuntimeComponent read(Reader reader) throws IOException {
        RuntimeComponent component = compositeActivator.getComponentContextHelper().read(reader);
        compositeActivator.configureComponentContext(component);
        return component;
    }
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.