static { userHomeDir = file("integTest.gradleUserHomeDir", "intTestHomeDir"); TestFile workerJar = userHomeDir.file("worker-main-jar-exploded"); for (Class<?> aClass : Arrays.asList(GradleWorkerMain.class, BootstrapClassLoaderWorker.class)) { String fileName = aClass.getName().replace('.', '/') + ".class"; workerJar .file(fileName) .copyFrom(DistributionIntegrationTestRunner.class.getClassLoader().getResource(fileName)); } System.setProperty("gradle.core.worker.jar", workerJar.getAbsolutePath()); }
private void checkExecute() throws IOException { context.checking( new Expectations() { { one(wrapperScriptGeneratorMock) .generate( targetWrapperJarPath + "/" + Wrapper.WRAPPER_JAR, targetWrapperJarPath + "/" + Wrapper.WRAPPER_PROPERTIES, new File(getProject().getProjectDir(), wrapper.getScriptDestinationPath())); } }); wrapper.execute(); TestFile unjarDir = tmpDir.createDir("unjar"); expectedTargetWrapperJar.unzipTo(unjarDir); unjarDir.file(GradleWrapperMain.class.getName().replace(".", "/") + ".class").assertIsFile(); Properties properties = GUtil.loadProperties(expectedTargetWrapperProperties); assertEquals(properties.getProperty(Wrapper.URL_ROOT_PROPERTY), wrapper.getUrlRoot()); assertEquals( properties.getProperty(Wrapper.DISTRIBUTION_BASE_PROPERTY), wrapper.getDistributionBase().toString()); assertEquals( properties.getProperty(Wrapper.DISTRIBUTION_PATH_PROPERTY), wrapper.getDistributionPath()); assertEquals( properties.getProperty(Wrapper.DISTRIBUTION_NAME_PROPERTY), wrapper.getArchiveName()); assertEquals( properties.getProperty(Wrapper.DISTRIBUTION_CLASSIFIER_PROPERTY), wrapper.getArchiveClassifier()); assertEquals( properties.getProperty(Wrapper.DISTRIBUTION_VERSION_PROPERTY), wrapper.getGradleVersion()); assertEquals( properties.getProperty(Wrapper.ZIP_STORE_BASE_PROPERTY), wrapper.getArchiveBase().toString()); assertEquals(properties.getProperty(Wrapper.ZIP_STORE_PATH_PROPERTY), wrapper.getArchivePath()); }