public static File createTempDir(String prefix) { return createTempDir(new File(System.getProperty("java.io.tmpdir")), prefix); }
public CoordinatorServer(Instance instance) { Preconditions.checkNotNull(instance, "instance is null"); this.instance = instance; tempDir = createTempDir("coordinator"); resourcesFile = new File(tempDir, "slots/airship-resources.properties"); }
public AgentServer(Instance instance) { Preconditions.checkNotNull(instance, "instance is null"); this.instance = instance; tempDir = createTempDir("agent"); resourcesFile = new File(tempDir, "slots/airship-resources.properties"); writeResources(AGENT_RESOURCES, resourcesFile); }
public InstallationHelper() throws Exception { File targetRepo = null; File binaryFile; try { targetRepo = createTempDir("repo"); binaryFile = new File(targetRepo, "binary.tar.gz"); createArchive(binaryFile); } catch (Exception e) { if (targetRepo != null) { deleteRecursively(targetRepo); } throw e; } this.targetRepo = targetRepo; appleInstallation = new Installation("apple", APPLE_ASSIGNMENT, binaryFile.toURI(), new File("README.txt").toURI(), ImmutableMap.of("memory", 512)); bananaInstallation = new Installation("banana", BANANA_ASSIGNMENT, binaryFile.toURI(), new File("README.txt").toURI(), ImmutableMap.of("cpu", 1)); }
public static void createArchive(File archive) throws Exception { File tempDir = createTempDir("archive"); try { // copy launcher to bin dir File binDir = new File(tempDir, "bin"); binDir.mkdirs(); File launcher = new File(binDir, "launcher"); asByteSource(getResource(ArchiveHelper.class, "launcher")).copyTo(asByteSink(launcher)); // make launcher executable launcher.setExecutable(true, true); // add a readme file Files.write(ArchiveHelper.class.getName() + " test archive", new File(tempDir, "README.txt"), UTF_8); // tar up the archive createTar(tempDir, archive); } finally { FileUtils.deleteRecursively(tempDir); } } }
targetRepo = createTempDir("repo");
public static File createRepoDir() throws Exception { File targetRepo = null; try { targetRepo = createTempDir("repo"); // tar up the archive and add them to the repository File appleArchiveV1 = new File(targetRepo, "apple-1.0.tar.gz"); File appleArchiveV2 = new File(targetRepo, "apple-2.0.tar.gz"); File bananaArchive = new File(targetRepo, "banana-2.0-SNAPSHOT.tar.gz"); createArchive(appleArchiveV1); appleArchiveV2.getParentFile().mkdirs(); Files.copy(appleArchiveV1, appleArchiveV2); bananaArchive.getParentFile().mkdirs(); Files.copy(appleArchiveV1, bananaArchive); // add prod configurations createConfig(targetRepo, "apple", "1.0"); createConfig(targetRepo, "apple", "2.0"); createConfig(targetRepo, "banana", "2.0-SNAPSHOT"); return targetRepo; } catch (Exception e) { if (targetRepo != null) { deleteRecursively(targetRepo); } throw e; } }
@BeforeMethod public void setUp() throws Exception { tempDir = FileUtils.createTempDir("airship"); config = new Config(); repo = new TestingMavenRepository(); interactiveUser = new MockInteractiveUser(true); outputFormat = new MockOutputFormat(); }
public static File createRepoDir() throws Exception { File targetRepo = null; try { targetRepo = createTempDir("repo"); // tar up the archive and add them to the repository File appleArchiveV1 = new File(targetRepo, "apple-1.0.tar.gz"); File appleArchiveV2 = new File(targetRepo, "apple-2.0.tar.gz"); File bananaArchive = new File(targetRepo, "banana-2.0-SNAPSHOT.tar.gz"); createArchive(appleArchiveV1); appleArchiveV2.getParentFile().mkdirs(); Files.copy(appleArchiveV1, appleArchiveV2); bananaArchive.getParentFile().mkdirs(); Files.copy(appleArchiveV1, bananaArchive); // add prod configurations createConfig(targetRepo, "apple", "1.0"); createConfig(targetRepo, "apple", "2.0"); createConfig(targetRepo, "banana", "2.0-SNAPSHOT"); return targetRepo; } catch (Exception e) { if (targetRepo != null) { deleteRecursively(targetRepo); } throw e; } }
@BeforeMethod public void setUp() throws Exception { tempDir = FileUtils.createTempDir("airship"); config = new Config(); repo = new TestingMavenRepository(); interactiveUser = new MockInteractiveUser(true); outputFormat = new MockOutputFormat(); }
File tempDir = createTempDir(baseDir, "tmp-install"); try {
targetRepo = createTempDir("repo");
localBinaryRepoDir = createTempDir("localBinaryRepoDir"); expectedStateDir = createTempDir("expected-state"); serviceInventoryCacheDir = createTempDir("service-inventory-cache");
localBinaryRepoDir = createTempDir("localBinaryRepoDir"); expectedStateDir = createTempDir("expected-state"); serviceInventoryCacheDir = createTempDir("service-inventory-cache");
@BeforeClass public void startServer() throws Exception { tempDir = createTempDir("agent"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("agent.id", UUID.randomUUID().toString()) .put("agent.coordinator-uri", "http://localhost:9999/") .put("agent.slots-dir", tempDir.getAbsolutePath()) .put("discovery.uri", "fake://server") .build(); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), new TestingNodeModule(), new JsonModule(), new TestingHttpServerModule(), new JaxrsModule(), new EventModule(), new AgentMainModule(), new ConfigurationModule(new ConfigurationFactory(properties))); server = injector.getInstance(TestingHttpServer.class); agent = injector.getInstance(Agent.class); server.start(); client = new ApacheHttpClient(); installationHelper = new InstallationHelper(); appleInstallation = installationHelper.getAppleInstallation(); bananaInstallation = installationHelper.getBananaInstallation(); }
@BeforeClass public void startServer() throws Exception { tempDir = createTempDir("agent"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("agent.id", UUID.randomUUID().toString()) .put("agent.coordinator-uri", "http://localhost:9999/") .put("agent.slots-dir", tempDir.getAbsolutePath()) .put("discovery.uri", "fake://server") .build(); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), new TestingNodeModule(), new JsonModule(), new TestingHttpServerModule(), new JaxrsModule(), new EventModule(), new AgentMainModule(), new ConfigurationModule(new ConfigurationFactory(properties))); server = injector.getInstance(TestingHttpServer.class); agent = injector.getInstance(Agent.class); server.start(); client = new JettyHttpClient(); installationHelper = new InstallationHelper(); appleInstallation = installationHelper.getAppleInstallation(); bananaInstallation = installationHelper.getBananaInstallation(); }
File nestedSymDir = null; try { baseDir = createTempDir("link-test");
throws Exception tempDir = createTempDir("agent"); Map<String, String> properties = ImmutableMap.<String, String>builder() .put("agent.id", UUID.randomUUID().toString())