@Test public void testTrim() { assertEquals(trimLeadingSegments("/a/b/c", '/', 0), "/a/b/c"); assertEquals(trimLeadingSegments("/a/b/c", '/', 1), "/b/c"); assertEquals(trimLeadingSegments("/a/b/c", '/', 2), "/c"); }
public AgentStatusRepresentation create(AgentStatus status) { Builder<SlotStatusRepresentation> builder = ImmutableList.builder(); for (SlotStatus slot : status.getSlotStatuses()) { builder.add(SlotStatusRepresentation.from(slot, Integer.MAX_VALUE, repository)); } return new AgentStatusRepresentation( status.getAgentId(), safeTruncate(status.getAgentId(), shortIdPrefixSize), status.getInstanceId(), status.getState(), status.getInternalUri(), status.getExternalUri(), status.getLocation(), trimLeadingSegments(status.getLocation(), '/', commonLocationParts), status.getInstanceType(), builder.build(), status.getResources(), status.getVersion()); } }
public CoordinatorStatusRepresentation create(CoordinatorStatus status) { return new CoordinatorStatusRepresentation( status.getCoordinatorId(), safeTruncate(status.getCoordinatorId(), shortIdPrefixSize), status.getInstanceId(), status.getState(), status.getInternalUri(), status.getExternalUri(), status.getLocation(), trimLeadingSegments(status.getLocation(), '/', commonLocationParts), status.getInstanceType(), status.getVersion()); } }
status.getInstanceId(), status.getLocation(), trimLeadingSegments(status.getLocation(), '/', commonLocationParts), binary, shortBinary,