Package org.rioproject.opstring

Examples of org.rioproject.opstring.ServiceElement


        public void recover(InputStream in) throws Exception {
            ObjectInputStream oistream = new ObjectInputStream(in);
            if(!logDirName.equals(oistream.readUTF()))
                throw new IOException("log from wrong implementation");
            DefaultServiceBeanContext serviceBeanContext = (DefaultServiceBeanContext)oistream.readObject();
            ServiceElement sElem = serviceBeanContext.getServiceElement();
            ServiceBeanConfig sAttr = sElem.getServiceBeanConfig();
            try {
                String[] groups = (String[])oistream.readObject();
                LookupLocator[] locators = (LookupLocator[])oistream.readObject();
                sAttr.setGroups(groups);
                sAttr.setLocators(locators);
            } catch(Throwable t) {
                logger.error("Couldnt get groups or locators", t);
            }
            sElem.setServiceBeanConfig(sAttr);
            serviceBeanContext.setServiceElement(sElem);
            restoredContext = serviceBeanContext;
        }
View Full Code Here


        statement.putServiceRecord(getUuid(), serviceRecord);
        serviceStatementManager.record(statement);
        //setChanged(StatusType.NORMAL);
        if(loaderLogger.isInfoEnabled()) {
            int instantiatedServiceCount = getInstantiatedServiceCount();
            ServiceElement service = serviceRecord.getServiceElement();
            logger.info("Instantiated {}, {}, total services active: {}",
                        ServiceLogUtil.logName(service),
                        ServiceLogUtil.discoveryInfo(service),
                        instantiatedServiceCount);
        }
View Full Code Here

    @Test
    public void testEnsureGroups() throws Exception {
        startLookup("foo");
        Assert.assertFalse(hasGroup(registrar, "gack"));
        ServiceElement service = createSE("gack");
        Assert.assertTrue(waitForDiscovery(listener));
        Assert.assertTrue(listener.discovered.get());
        DL newDiscoListener = new DL();
        new LookupDiscoveryManager(new String[]{"gack"}, null, newDiscoListener);
        deploymentVerifier.ensureGroups(service);
View Full Code Here

    public void testEnsureMultiGroups() throws Exception {
        startLookup("foo");
        Assert.assertTrue(waitForDiscovery(listener));
        Assert.assertFalse(hasGroup(registrar, "gack"));
        Assert.assertFalse(hasGroup(registrar, "blutarsky"));
        ServiceElement service = createSE("gack", "blutarsky");
        Assert.assertTrue(listener.discovered.get());
        DL newDiscoListener = new DL();
        new LookupDiscoveryManager(new String[]{"gack"}, null, newDiscoListener);
        deploymentVerifier.ensureGroups(service);
        Assert.assertTrue(waitForDiscovery(newDiscoListener));
View Full Code Here

        Assert.assertTrue(hasGroup(registrar, "blutarsky"));
    }

    @Test(expected = IOException.class)
    public void testAllGroupsFail() throws Exception {
        ServiceElement service = new ServiceElement();
        ServiceBeanConfig serviceBeanConfig = new ServiceBeanConfig();
        serviceBeanConfig.setGroups("all");
        service.setServiceBeanConfig(serviceBeanConfig);
        deploymentVerifier.ensureGroups(service);
    }
View Full Code Here

    public ComputeResourceUtilization getComputeResourceUtilization() {
        return computeResource.getComputeResourceUtilization();
    }

    public void serviceInstantiated(final ServiceRecord record) {
        ServiceElement service = record.getServiceElement();
        logger.info("Instantiated {}, {}", ServiceLogUtil.logName(service), ServiceLogUtil.discoveryInfo(service));
        try {
            listener.serviceInstantiated(record);
        } catch (RemoteException e) {
            logger.warn("Notifying Cybernode that the service is active", e);
View Full Code Here

        service.setServiceBeanConfig(serviceBeanConfig);
        deploymentVerifier.ensureGroups(service);
    }

    private ServiceElement createSE(String... groups) {
        ServiceElement service = new ServiceElement();
        ServiceBeanConfig serviceBeanConfig = new ServiceBeanConfig();
        serviceBeanConfig.setGroups(groups);
        service.setServiceBeanConfig(serviceBeanConfig);
        return service;
    }
View Full Code Here

    /**
     * @see org.rioproject.deploy.ServiceStatementManager#record
     */
    public void record(ServiceStatement statement) {
        synchronized (statementMap) {
            ServiceElement key = statement.getServiceElement();
            boolean active = statement.hasActiveServiceRecords();
            if (active) {
                statementMap.put(key, statement);

            } else {
View Full Code Here

        //Assert.assertTrue(notSupported.size()==2);
        Assert.assertFalse(instantiatorResource.canProvision(request));
    }

    ServiceElement createServiceElement() {
        ServiceElement serviceElement = TestUtil.makeServiceElement("foo", "test", 1);
        serviceElement.setServiceLevelAgreements(createServiceLevelAgreements(true, true));
        return serviceElement;
    }
View Full Code Here

    public static ServiceElement makeServiceElement(String name, String opStringName) {
        return makeServiceElement(name, opStringName, 1);
    }

    public static ServiceElement makeServiceElement(String name, String opStringName, int planned) {
        ServiceElement elem = new ServiceElement();
        ClassBundle exports = new ClassBundle(Object.class.getName());
        elem.setExportBundles(exports);
        ClassBundle main = new ClassBundle("");
        elem.setComponentBundle(main);
        ServiceBeanConfig sbc = new ServiceBeanConfig();
        sbc.setName(name);
        sbc.setOperationalStringName(opStringName);
        elem.setServiceBeanConfig(sbc);
        elem.setPlanned(planned);
        return elem;
    }
View Full Code Here

TOP

Related Classes of org.rioproject.opstring.ServiceElement

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.