protected Maybe<MachineLocation> getMachine() { return Machines.findUniqueMachineLocation(entity.getLocations()); }
protected MachineLocation getMachine() { Supplier<MachineLocation> supplier = config().get(MACHINE); if (supplier != null) { return supplier.get(); } else { return Locations.findUniqueMachineLocation(entity.getLocations()).get(); } }
protected String getExplanation(Maybe<Lifecycle> state) { Duration serviceFailedStabilizationDelay = getConfig(ENTITY_FAILED_STABILIZATION_DELAY); Duration serviceRecoveredStabilizationDelay = getConfig(ENTITY_RECOVERED_STABILIZATION_DELAY); return String.format("location=%s; status=%s; lastPublished=%s; timeNow=%s; "+ "currentFailurePeriod=%s; currentRecoveryPeriod=%s", entity.getLocations(), (state.orNull() != null ? state : "<unreported>"), config().get(LAST_PUBLISHED), Time.makeDateString(System.currentTimeMillis()), (currentFailureStartTime != null ? getTimeStringSince(currentFailureStartTime) : "<none>") + " (stabilization "+Time.makeTimeStringRounded(serviceFailedStabilizationDelay) + ")", (currentRecoveryStartTime != null ? getTimeStringSince(currentRecoveryStartTime) : "<none>") + " (stabilization "+Time.makeTimeStringRounded(serviceRecoveredStabilizationDelay) + ")"); }
public void apply(Entity source, Object valueIgnored) { Location targetVm = Iterables.getOnlyElement(((EntityLocal)serviceToForward).getLocations(), null); if (targetVm==null) { log.warn("Skipping port forward rule for "+serviceToForward+" because it does not have a location");
@Override protected CalculatedStatus calculateStatus() { Maybe<SshMachineLocation> sshMachineOption = Machines.findUniqueMachineLocation(entity.getLocations(), SshMachineLocation.class); if (sshMachineOption.isPresent()) { SshMachineLocation sshMachine = sshMachineOption.get();
@BeforeMethod(alwaysRun=true) public void setUp() throws Exception { app = TestApplication.Factory.newManagedInstanceForTests(); entity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(TestApplication.LOCALHOST_MACHINE_SPEC)); machine = Locations.findUniqueSshMachineLocation(entity.getLocations()).get(); app.start(ImmutableList.<Location>of()); tempFile = File.createTempFile("testSshCommand", ".txt"); }
@BeforeMethod(alwaysRun=true) public void setUp() throws Exception { app = TestApplication.Factory.newManagedInstanceForTests(); entity = app.createAndManageChild(EntitySpec.create(TestEntity.class).location(TestApplication.LOCALHOST_MACHINE_SPEC)); machine = Locations.findUniqueSshMachineLocation(entity.getLocations()).get(); app.start(ImmutableList.<Location>of()); }