use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeImpl method setOffline.
public void setOffline() throws ServiceLocatorException, InterruptedException {
NodePath endpointStatusNodePath = child(LIVE);
NodePath expNodePath = child(TIMETOLIVE);
zkBackend.ensurePathDeleted(endpointStatusNodePath, false);
zkBackend.ensurePathDeleted(expNodePath, false);
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeImpl method setLive.
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);
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeTest method setOffline.
@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();
verify(backend);
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeTest method isLiveTrue.
@Test
public void isLiveTrue() throws Exception {
NodePath livePath = endpointNode.child(LIVE);
expect(backend.nodeExists(livePath)).andReturn(true);
replay(backend);
assertTrue(endpointNode.isLive());
verify(backend);
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeTest method setLiveNonPersistent.
@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);
verify(backend);
}
Aggregations