Package org.talend.esb.servicelocator.client.internal

Examples of org.talend.esb.servicelocator.client.internal.NodePath


        zkBackend.ensurePathDeleted(this, true);       
    }

    public void setLive(boolean persistent) throws ServiceLocatorException, InterruptedException {
        CreateMode mode = persistent ? CreateMode.PERSISTENT : CreateMode.EPHEMERAL;
        NodePath endpointStatusNodePath = child(LIVE);
        zkBackend.ensurePathExists(endpointStatusNodePath, mode);
       
        // the old expiration time is not valid after re-registering the endpoint
        zkBackend.ensurePathDeleted(child(TIMETOLIVE), false);
    }
View Full Code Here


        // the old expiration time is not valid after re-registering the endpoint
        zkBackend.ensurePathDeleted(child(TIMETOLIVE), false);
    }

    public void setOffline() throws ServiceLocatorException, InterruptedException {
        NodePath endpointStatusNodePath = child(LIVE);
        NodePath expNodePath = child(TIMETOLIVE);
        zkBackend.ensurePathDeleted(endpointStatusNodePath, false);
        zkBackend.ensurePathDeleted(expNodePath, false);
    }
View Full Code Here

        return zkBackend.nodeExists(child(LIVE));
    }
   
    @Override
    public Date getExpiryTime() throws ServiceLocatorException, InterruptedException {
        NodePath expNodePath = child(TIMETOLIVE);
       
        if (!zkBackend.nodeExists(expNodePath)) {
            return null;
        }
       
View Full Code Here

        return new Date(Long.valueOf(strTime));
    }
   
    @Override
    public void setExpiryTime(Date expiryTime, boolean persistent) throws ServiceLocatorException, InterruptedException {
        NodePath expNodePath = child(TIMETOLIVE);
       
        String strTime = Long.toString(expiryTime.getTime());
        byte[] content = strTime.getBytes(UTF8);
       
        CreateMode mode = persistent ? CreateMode.PERSISTENT : CreateMode.EPHEMERAL;
View Full Code Here

        verify(backend);
    }

    @Test
    public void setLivePersistent() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        backend.ensurePathExists(livePath, CreateMode.PERSISTENT);
        backend.ensurePathDeleted(endpointNode.child(TIMETOLIVE), false);
        replay(backend);
       
        endpointNode.setLive(true);
View Full Code Here

        verify(backend);
    }

    @Test
    public void setLiveNonPersistent() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        backend.ensurePathExists(livePath, CreateMode.EPHEMERAL);
        backend.ensurePathDeleted(endpointNode.child(TIMETOLIVE), false);
        replay(backend);
       
        endpointNode.setLive(false);
View Full Code Here

        verify(backend);
    }

    @Test
    public void setOffline() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        NodePath expiryPath = endpointNode.child(TIMETOLIVE);
        backend.ensurePathDeleted(livePath, false);
        backend.ensurePathDeleted(expiryPath, false);
        replay(backend);
       
        endpointNode.setOffline();
View Full Code Here

        verify(backend);
    }

    @Test
    public void isLiveTrue() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        expect(backend.nodeExists(livePath)).andReturn(true);
        replay(backend);
       
        assertTrue(endpointNode.isLive());
View Full Code Here

        verify(backend);
    }

    @Test
    public void isLiveFalse() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        expect(backend.nodeExists(livePath)).andReturn(false);
        replay(backend);
       
        assertFalse(endpointNode.isLive());
View Full Code Here

        verify(backend);
    }

    @Test
    public void ensureRemoved() throws Exception {
        NodePath livePath = endpointNode.child(LIVE);
        NodePath expiryPath = endpointNode.child(TIMETOLIVE);
        backend.ensurePathDeleted(livePath, false);
        backend.ensurePathDeleted(expiryPath, false);
        backend.ensurePathDeleted(endpointNode, true);
        replay(backend);
       
View Full Code Here

TOP

Related Classes of org.talend.esb.servicelocator.client.internal.NodePath

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.