public static File newFile(File parent, String... paths) { Preconditions.checkNotNull(parent, "parent is null"); Preconditions.checkNotNull(paths, "paths is null"); return newFile(parent, ImmutableList.copyOf(paths)); }
public static File newFile(String parent, String... paths) { Preconditions.checkNotNull(parent, "parent is null"); Preconditions.checkNotNull(paths, "paths is null"); return newFile(new File(parent), ImmutableList.copyOf(paths)); }
public static void createConfig(File dir, String artifactId, String version) throws Exception File configFile = newFile(dir, artifactId + "-" + version + ".config");
public static void createConfig(File dir, String artifactId, String version) throws Exception File configFile = newFile(dir, artifactId + "-" + version + ".config");
public static void createConfig(File dir, String groupId, String artifactId, String version, String timestampVersion) throws Exception File configFile = newFile(dir, groupId, artifactId,
public static void createConfig(File dir, String groupId, String artifactId, String version, String timestampVersion) throws Exception File configFile = newFile(dir, groupId, artifactId,
mavenMetadata.versioning.versions.add(version.version); MavenMetadata.marshalMavenMetadata(newFile(dir, groupId, artifactId, "maven-metadata.xml"), mavenMetadata); snapshotMetadata.versioning.snapshotVersions.add(snapshotVersion); MavenMetadata.marshalMavenMetadata(newFile(dir, groupId, artifactId, version.version, "maven-metadata.xml"), snapshotMetadata);
mavenMetadata.versioning.versions.add(version.version); MavenMetadata.marshalMavenMetadata(newFile(dir, groupId, artifactId, "maven-metadata.xml"), mavenMetadata); snapshotMetadata.versioning.snapshotVersions.add(snapshotVersion); MavenMetadata.marshalMavenMetadata(newFile(dir, groupId, artifactId, version.version, "maven-metadata.xml"), snapshotMetadata);
@Test public void testRestart() throws Exception { initializeOneAgent(); appleSlot1.start(); coordinator.updateAllAgentsAndWait(); assertEquals(appleSlot1.status().getState(), RUNNING); File pidFile = newFile(appleSlot1.status().getInstallPath(), "..", "installation", "launcher.pid").getCanonicalFile(); String pidBeforeRestart = Files.readFirstLine(pidFile, Charsets.UTF_8); Request request = Request.Builder.preparePut() .setUri(coordinatorUriBuilder().appendPath("/v1/slot/lifecycle").addParameter("binary", "*:apple:*").build()) .setBodyGenerator(createStaticBodyGenerator("restarting", UTF_8)) .build(); List<SlotStatusRepresentation> actual = httpClient.execute(request, createJsonResponseHandler(slotStatusesCodec, Status.OK.getStatusCode())); List<SlotStatusRepresentation> expected = ImmutableList.of( slotStatusRepresentationFactory.create(appleSlot1.status().changeInstanceId(agentInstanceId)), slotStatusRepresentationFactory.create(appleSlot2.status().changeInstanceId(agentInstanceId))); assertEqualsNoOrder(actual, expected); assertEquals(appleSlot1.status().getState(), RUNNING); assertEquals(appleSlot2.status().getState(), RUNNING); assertEquals(bananaSlot.status().getState(), STOPPED); String pidAfterRestart = Files.readFirstLine(pidFile, Charsets.UTF_8); assertNotEquals(pidAfterRestart, pidBeforeRestart); }