Package org.rioproject.impl.associations

Examples of org.rioproject.impl.associations.DefaultAssociationManagement


    /**
     * @see org.rioproject.servicebean.ServiceBeanContext#getAssociationManagement
     */
    public org.rioproject.associations.AssociationManagement getAssociationManagement() {
        if(associationManagement==null) {
            this.associationManagement = new DefaultAssociationManagement();
        }           
        return (associationManagement);
    }
View Full Code Here


@RunWith(RioTestRunner.class)
public class AssociationVersionTest {

    @Test
    public void testVersionedAssociations() throws ExecutionException, InterruptedException, IOException {
        AssociationManagement aMgr = new DefaultAssociationManagement();
        AssociationDescriptor descriptor = AssociationDescriptor.create("Dummy", Dummy.class, System.getProperty("org.rioproject.groups"));
        descriptor.setMatchOnName(false);
        descriptor.setVersion("2.1");
        Association<Dummy> association = aMgr.addAssociationDescriptor(descriptor);
        Dummy dummy = association.getServiceFuture().get();
        Assert.assertNotNull(dummy);
        Assert.assertEquals("Expected 1 got " + association.getServiceCount(), 1, association.getServiceCount());
        Assert.assertTrue("Expected \'His Brother Darrel\', got " + dummy.getName(), "His Brother Darrel".equals(dummy.getName()));
    }
View Full Code Here

        Assert.assertTrue("Expected \'His Brother Darrel\', got " + dummy.getName(), "His Brother Darrel".equals(dummy.getName()));
    }

    @Test
    public void testVersionedAssociationRange() throws ExecutionException, InterruptedException, IOException {
        AssociationManagement aMgr = new DefaultAssociationManagement();
        AssociationDescriptor descriptor = AssociationDescriptor.create("Dummy", Dummy.class, System.getProperty("org.rioproject.groups"));
        descriptor.setMatchOnName(false);
        descriptor.setVersion("2.8");
        Association<Dummy> association = aMgr.addAssociationDescriptor(descriptor);
        Dummy dummy = association.getServiceFuture().get();
        Assert.assertNotNull(dummy);
        Assert.assertEquals("Expected 1 got "+association.getServiceCount(), 1, association.getServiceCount());
        Assert.assertTrue("Expected \'His Other Brother Darrel\', got "+dummy.getName(), "His Other Brother Darrel".equals(dummy.getName()));
    }
View Full Code Here

        Assert.assertTrue("Expected \'His Other Brother Darrel\', got "+dummy.getName(), "His Other Brother Darrel".equals(dummy.getName()));
    }

    @Test
    public void testVersionedAssociationNoMatches() throws ExecutionException, InterruptedException, IOException {
        AssociationManagement aMgr = new DefaultAssociationManagement();
        AssociationDescriptor descriptor = AssociationDescriptor.create("Dummy", Dummy.class, System.getProperty("org.rioproject.groups"));
        descriptor.setMatchOnName(false);
        descriptor.setVersion("1.0");
        Association<Dummy> association = aMgr.addAssociationDescriptor(descriptor);
        Dummy dummy = null;
        try {
            dummy = association.getServiceFuture().get(5, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
            System.out.println("Received expected TimeoutException");
View Full Code Here

        Assert.assertEquals("Expected 0 got "+association.getServiceCount(), 0, association.getServiceCount());
    }

    @Test
    public void testVersionedAssociationMatchesAll() throws ExecutionException, InterruptedException, IOException {
        AssociationManagement aMgr = new DefaultAssociationManagement();
        AssociationDescriptor descriptor = AssociationDescriptor.create("Dummy", Dummy.class, System.getProperty("org.rioproject.groups"));
        descriptor.setMatchOnName(false);
        Association<Dummy> association = aMgr.addAssociationDescriptor(descriptor);
        Dummy dummy = null;
        TimeoutException timeoutException = null;
        try {
            dummy = association.getServiceFuture().get(5, TimeUnit.SECONDS);
        } catch (TimeoutException e) {
View Full Code Here

         */
        AssociationDescriptor descriptor = AssociationDescriptor.create("Calculator",
                                                                        Calculator.class,
                                                                        testManager.getGroups());
        /* Create association management and get the Future. */
        org.rioproject.associations.AssociationManagement aMgr = new DefaultAssociationManagement();
        Association<Calculator> association = aMgr.addAssociationDescriptor(descriptor);
        future = association.getServiceFuture();
    }
View Full Code Here

     * Set the configuration and wire up the Monitor association.
     */
    @SuppressWarnings("unused")
    public void setServiceBeanContext(ServiceBeanContext context) {
        this.context = context;
        DefaultAssociationManagement associationMgmt =
            (DefaultAssociationManagement) context.getAssociationManagement();
        boolean createCoreAssociations = true;
        String s = (String)context.getInitParameter("create-core-associations");
        if(s!=null && s.equals("no"))
            createCoreAssociations = false;
        if(createCoreAssociations) {
            AssociationDescriptor monitor =
                createAssociationDescriptor("Monitor", context.getServiceBeanConfig().getGroups());
            Association<ProvisionMonitor> monitorAssociation = associationMgmt.addAssociationDescriptor(monitor);
            monitorFuture = monitorAssociation.getServiceFuture();
        }
    }
View Full Code Here

                                 String[] groups,
                                 ClassLoader ruleLoader) {
        if(kAgent==null)
            throw new IllegalArgumentException("kAgent is null");
        this.ruleMap = ruleMap;
        associationMgmt = new DefaultAssociationManagement();
        associationMgmt.setBackend(this);
        this.kAgent = kAgent;
        this.monitor = monitor;
        this.groups = groups;
        this.ruleLoader = ruleLoader;
View Full Code Here

        DefaultAssociationManagement mgr;
        String serviceName;

        AssociationHelper(String serviceName, Class<T> serviceClass, String... groups) {
            this.serviceName = serviceName;
            mgr = new DefaultAssociationManagement();
            services = mgr.addAssociationDescriptor(AssociationDescriptor.create(serviceName,
                                                                                 null,
                                                                                 serviceClass,
                                                                                 groups));
        }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.associations.DefaultAssociationManagement

Copyright © 2018 www.massapicom. 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.