use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeTest method isLiveFalse.
@Test
public void isLiveFalse() throws Exception {
NodePath livePath = endpointNode.child(LIVE);
expect(backend.nodeExists(livePath)).andReturn(false);
replay(backend);
assertFalse(endpointNode.isLive());
verify(backend);
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeImpl method getExpiryTime.
@Override
public Date getExpiryTime() throws ServiceLocatorException, InterruptedException {
NodePath expNodePath = child(TIMETOLIVE);
if (!zkBackend.nodeExists(expNodePath)) {
return null;
}
byte[] content = zkBackend.getContent(expNodePath);
String strTime = new String(content, UTF8);
return new Date(Long.valueOf(strTime));
}
use of org.talend.esb.servicelocator.client.internal.NodePath in project tesb-rt-se by Talend.
the class EndpointNodeImpl method setExpiryTime.
@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;
zkBackend.ensurePathExists(expNodePath, mode, content);
}
Aggregations