Package org.rioproject.deploy

Examples of org.rioproject.deploy.ServiceStatement


        List<ServiceStatement> list = new ArrayList<ServiceStatement>();
        File[] statements = recordRoot.listFiles();
        if(statements!=null) {
            for (File statement : statements) {
                try {
                    ServiceStatement stmnt = read(statement);
                    if (stmnt != null)
                        list.add(stmnt);
                } catch (Exception e) {
                    logger.error("Getting ServiceStatement instances", e);
                }
View Full Code Here


    /**
     * @see org.rioproject.deploy.ServiceStatementManager#get
     */
    public ServiceStatement get(ServiceElement sElem) {
        ServiceStatement statement = null;
        try {           
            statement = read(makeName(sElem) + STATEMENT_EXT);
        } catch(IOException e) {
            logger.error("Getting ServiceStatement", e);
        } catch(ClassNotFoundException e) {
View Full Code Here

    /**
     * @see org.rioproject.deploy.ServiceStatementManager#get
     */
    public ServiceStatement get(ServiceElement sElem) {
        ServiceStatement statement;
        synchronized (statementMap) {
            statement = statementMap.get(sElem);
        }
         return statement;
    }
View Full Code Here

    @Test
    public void testRecordAndRetrieve() throws Exception {
        Assert.assertEquals(statements.size(), serviceStatementManager.get().length);
        for(ServiceStatement statement : statements) {
            ServiceStatement s = serviceStatementManager.get(statement.getServiceElement());
            Assert.assertEquals(statement, s);
            Assert.assertEquals(1, s.getServiceRecords(ServiceRecord.ACTIVE_SERVICE_RECORD).length);
            Assert.assertEquals(0, s.getServiceRecords(ServiceRecord.INACTIVE_SERVICE_RECORD).length);
        }

    }
View Full Code Here

        for (String name : names) {
            Uuid uuid = UuidFactory.generate();
            ServiceElement element = makeServiceElement(name);
            ServiceRecord serviceRecord = new ServiceRecord(uuid, element, "hostname");
            ServiceStatement statement = new ServiceStatement(element);
            statement.putServiceRecord(recordingUuid, serviceRecord);
            statements.add(statement);
        }
        for(ServiceStatement statement : statements) {
            serviceStatementManager.record(statement);
        }
View Full Code Here

    @Test
    public void testGetServiceStatementsAfterSettingInactiveThenActive() throws Exception {
        ServiceElement element = makeServiceElement("Buckwheat");
        Assert.assertNotNull(element);
        ServiceStatement statement = serviceStatementManager.get(element);
        Assert.assertNotNull(statement);
        ServiceRecord[] records = statement.getServiceRecords();
        Assert.assertEquals(1, records.length);
        ServiceRecord inActiveServiceRecord = records[0];
        inActiveServiceRecord.setType(ServiceRecord.INACTIVE_SERVICE_RECORD);
        /* Putting the INACTIVE_SERVICE_RECORD ServiceRecord will replace the ACTIVE_SERVICE_RECORD since the
         * records have the same Uuid */
        statement.putServiceRecord(recordingUuid, inActiveServiceRecord);
        ServiceRecord activeServiceRecord = new ServiceRecord(UuidFactory.generate(),
                                                              statement.getServiceElement(),
                                                              "hostname");
        statement.putServiceRecord(recordingUuid, activeServiceRecord);
        Assert.assertEquals(2, statement.getServiceRecords().length);
        serviceStatementManager.record(statement);

        ServiceStatement fetchedStatement = serviceStatementManager.get(element);
        Assert.assertNotNull(fetchedStatement);
        Assert.assertEquals(2, fetchedStatement.getServiceRecords().length);

        ServiceRecord[] activeRecords = fetchedStatement.getServiceRecords(ServiceRecord.ACTIVE_SERVICE_RECORD);
        Assert.assertEquals(1, activeRecords.length);
    }
View Full Code Here

TOP

Related Classes of org.rioproject.deploy.ServiceStatement

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.