org.gradle.internal.impldep.org.testng.Assert Java Examples
The following examples show how to use
org.gradle.internal.impldep.org.testng.Assert.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppEngineStandardExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 6 votes |
@Test public void testFileAsString() throws IOException { Project p = setUpTestProject("file-as-string"); AppEngineStandardExtension ext = p.getExtensions().getByType(AppEngineStandardExtension.class); StageStandardExtension stage = ext.getStage(); RunExtension run = ext.getRun(); ToolsExtension tools = ext.getTools(); Assert.assertEquals(run.getServices().size(), 1); Assert.assertEquals("test", run.getServices().get(0).getName()); Assert.assertEquals("test", stage.getSourceDirectory().getName()); Assert.assertEquals("test", stage.getStagingDirectory().getName()); Assert.assertEquals("test", stage.getDockerfile().getName()); Assert.assertEquals("test", tools.getCloudSdkHome().getName()); }
Example #2
Source File: AppEngineStandardExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 6 votes |
@Test public void testFileAsFile() throws IOException { Project p = setUpTestProject("file-as-file"); AppEngineStandardExtension ext = p.getExtensions().getByType(AppEngineStandardExtension.class); RunExtension run = ext.getRun(); StageStandardExtension stage = ext.getStage(); ToolsExtension tools = ext.getTools(); Assert.assertEquals(run.getServices().size(), 1); Assert.assertEquals("test", run.getServices().get(0).getName()); Assert.assertEquals("test", stage.getSourceDirectory().getName()); Assert.assertEquals("test", stage.getStagingDirectory().getName()); Assert.assertEquals("test", stage.getDockerfile().getName()); Assert.assertEquals("test", tools.getCloudSdkHome().getName()); }
Example #3
Source File: ProtoParserTest.java From beast with Apache License 2.0 | 5 votes |
@Test(expected = StencilRuntimeException.class) public void shouldFailWhenNotAbleToFindTheProtoClass() throws InvalidProtocolBufferException { ProtoParser protoParser = new ProtoParser(stencilClient, "invalid_class_name"); protoParser.parse("".getBytes()); Assert.fail("Expected to get an exception"); }
Example #4
Source File: HelmPackageTest.java From gradle-plugins with Apache License 2.0 | 5 votes |
@Before public void setup() throws IOException { File tempDir = new File("build/tmp/helm"); tempDir.mkdirs(); workingDir = new File(tempDir, "demo"); workingDir.mkdirs(); File chartFolder = new File(workingDir, "src/main/helm/helmapp"); File remplateFolder = new File(chartFolder, "templates"); remplateFolder.mkdirs(); System.setProperty("org.gradle.daemon", "false"); File gradleFile = new File(workingDir, "build.gradle"); File chartFile = new File(chartFolder, "Chart.yaml"); File valuesFile = new File(chartFolder, "values.yaml"); File serviceFile = new File(remplateFolder, "service.yaml"); ClassLoader cl = getClass().getClassLoader(); Assert.assertNotNull(cl.getResource("plugin-under-test-metadata.properties")); File settingsFile = new File(workingDir, "settings.gradle"); FileUtils.write(settingsFile, "", StandardCharsets.UTF_8); IOUtils.copy(cl.getResourceAsStream("build.gradle"), new FileOutputStream(gradleFile)); IOUtils.copy(cl.getResourceAsStream("Chart.yaml"), new FileOutputStream(chartFile)); IOUtils.copy(cl.getResourceAsStream("values.yaml"), new FileOutputStream(valuesFile)); IOUtils.copy(cl.getResourceAsStream("service.yaml"), new FileOutputStream(serviceFile)); }
Example #5
Source File: HelmPackageTest.java From gradle-plugins with Apache License 2.0 | 5 votes |
@Test public void testPackaging() throws IOException { GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("helmPackage", "--stacktrace").forwardOutput(); runner.build(); File helmFile = new File(workingDir, "build/helm/helmapp-0.1.0.tgz"); Assert.assertTrue(helmFile.exists()); }
Example #6
Source File: SchemaGenerationPluginTest.java From gradle-plugins with Apache License 2.0 | 5 votes |
@Test public void checkBasicFlyway() throws IOException { check(false, "basic-creation"); File expectedSql = new File(workingDir, "expected_create.sql"); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("basic-creation/expected_create.sql"), new FileOutputStream(expectedSql)); Assert.assertTrue( FileUtils.contentEqualsIgnoreEOL( expectedSql, new File(workingDir, FLYWAY_ACTUAL_SCRIPT), "UTF-8" ) ); }
Example #7
Source File: SchemaGenerationPluginTest.java From gradle-plugins with Apache License 2.0 | 5 votes |
@Test public void checkBasicLiquibase() throws IOException { check(true, "basic-creation"); File expectedFile = new File(workingDir, LIQUIBASE_ACTUAL_CHANGELOG); Assert.assertTrue(expectedFile.exists()); }
Example #8
Source File: AppEngineStandardExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 5 votes |
@Test public void testReadEnvironment() throws IOException { Project p = setUpTestProject("environment-params"); AppEngineStandardExtension ext = p.getExtensions().getByType(AppEngineStandardExtension.class); RunExtension run = ext.getRun(); Assert.assertEquals(run.getEnvironment(), ImmutableMap.of("key1", "value1", "key2", "value2")); }
Example #9
Source File: AppEngineStandardExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 5 votes |
@Test public void testFilesAsString() throws IOException { Project p = setUpTestProject("files-as-string"); AppEngineStandardExtension ext = p.getExtensions().getByType(AppEngineStandardExtension.class); RunExtension run = ext.getRun(); Assert.assertEquals(run.getServices().size(), 2); Assert.assertEquals("test0", run.getServices().get(0).getName()); Assert.assertEquals("test1", run.getServices().get(1).getName()); }
Example #10
Source File: AppEngineStandardExtensionTest.java From app-gradle-plugin with Apache License 2.0 | 5 votes |
@Test public void testFilesAsFiles() throws IOException { Project p = setUpTestProject("files-as-files"); AppEngineStandardExtension ext = p.getExtensions().getByType(AppEngineStandardExtension.class); RunExtension run = ext.getRun(); Assert.assertEquals(run.getServices().size(), 2); Assert.assertEquals("test0", run.getServices().get(0).getName()); Assert.assertEquals("test1", run.getServices().get(1).getName()); }
Example #11
Source File: HelmSysTest.java From gradle-plugins with Apache License 2.0 | 4 votes |
@Test public void testPackaging() throws IOException, InterruptedException { File tempDir = new File("build/tmp/systest"); tempDir.mkdirs(); workingDir = new File(tempDir, "demo"); workingDir.mkdirs(); File chartFolder = new File(workingDir, "src/main/helm/helmapp"); File remplateFolder = new File(chartFolder, "templates"); remplateFolder.mkdirs(); System.setProperty("org.gradle.daemon", "false"); File gradleFile = new File(workingDir, "build.gradle"); File tillerFile = new File(workingDir, "src/main/kubectl/tiller-template.yaml"); tillerFile.getParentFile().mkdirs(); File chartFile = new File(chartFolder, "Chart.yaml"); File valuesFile = new File(chartFolder, "values.yaml"); File serviceFile = new File(remplateFolder, "service.yaml"); File tplFile = new File(remplateFolder, "_helpers.tpl"); Assert.assertNotNull(getClass().getClassLoader().getResource("plugin-under-test-metadata.properties")); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("build.gradle"), new FileOutputStream(gradleFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("Chart.yaml"), new FileOutputStream(chartFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("values.yaml"), new FileOutputStream(valuesFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("service.yaml"), new FileOutputStream(serviceFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("_helpers.tpl"), new FileOutputStream(tplFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("tiller-template.yaml"), new FileOutputStream(tillerFile)); try { GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("ocSetup", "--stacktrace").forwardOutput(); runner.build(); // wait with oc client runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("ocWaitForTiller", "--stacktrace").forwardOutput(); runner.build(); // install software runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("helmInstall", "--stacktrace").forwardOutput(); runner.build(); // wait for tiller again (with kubectl client for testing purposes) // TODO replacce with something meaningful => setup proper app runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("kubectlWaitForTiller", "--stacktrace").forwardOutput(); runner.build(); File helmPackageFile = new File(workingDir, "build/distributions/helmapp-0.1.0.tgz"); Assert.assertTrue(helmPackageFile.exists()); } finally { /* GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("ocDeleteProject", "--stacktrace").forwardOutput(); runner.build(); */ } }
Example #12
Source File: HelmBootstrapSysTest.java From gradle-plugins with Apache License 2.0 | 4 votes |
@Test public void testPackaging() throws IOException, InterruptedException { File tempDir = new File("build/tmp/systest"); tempDir.mkdirs(); workingDir = new File(tempDir, "demoBootstrap"); workingDir.mkdirs(); File chartFolder = new File(workingDir, "src/main/helm/helmapp"); File remplateFolder = new File(chartFolder, "templates"); remplateFolder.mkdirs(); System.setProperty("org.gradle.daemon", "false"); File gradleFile = new File(workingDir, "build.gradle"); File tillerFile = new File(workingDir, "tiller-template.yaml"); File chartFile = new File(chartFolder, "Chart.yaml"); File valuesFile = new File(chartFolder, "values.yaml"); File serviceFile = new File(remplateFolder, "service.yaml"); File tplFile = new File(remplateFolder, "_helpers.tpl"); Assert.assertNotNull(getClass().getClassLoader().getResource("plugin-under-test-metadata.properties")); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("build.gradle"), new FileOutputStream(gradleFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("Chart.yaml"), new FileOutputStream(chartFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("values.yaml"), new FileOutputStream(valuesFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("service.yaml"), new FileOutputStream(serviceFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("_helpers.tpl"), new FileOutputStream(tplFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("tiller-template.yaml"), new FileOutputStream(tillerFile)); try { // install software GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("helmClientVersion", "--stacktrace").forwardOutput(); runner.build(); } finally { /* GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("ocDeleteProject", "--stacktrace").forwardOutput(); runner.build(); */ } }
Example #13
Source File: SchemaGenerationPluginTest.java From gradle-plugins with Apache License 2.0 | 4 votes |
private void check(boolean liquibase, String example) throws IOException { testFolder.create(); workingDir = testFolder.getRoot(); File javaFolder = testFolder.newFolder("src", "main", "java", "example"); File secondJavaPackage = testFolder.newFolder("src", "main", "java", "excluded"); File resourceFolder = testFolder.newFolder("src", "main", "resources"); File metaInfFolder = testFolder.newFolder("src", "main", "resources", "META-INF"); System.setProperty("org.gradle.daemon", "false"); File gradleFile = testFolder.newFile("build.gradle"); File entityFile = new File(javaFolder, "ExampleEntity.java"); File excludedFile = new File(secondJavaPackage, "ExcludedEntity.java"); File persistenceFile = new File(metaInfFolder, "persistence.xml"); File exampleResource = new File(resourceFolder, "example_config.properties"); File settingsFile = testFolder.newFile("settings.gradle"); FileUtils.write(settingsFile, "", StandardCharsets.UTF_8); // make sure to run gradle first Assert.assertNotNull(getClass().getClassLoader().getResource("plugin-under-test-metadata.properties")); IOUtils.copy(getClass().getClassLoader().getResourceAsStream( example + (liquibase ? "/input_liquibase.gradle" : "/input_flyway.gradle")), new FileOutputStream(gradleFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream(example + "/input_persistence.xml"), new FileOutputStream(persistenceFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream(example + "/input_entity.java"), new FileOutputStream(entityFile)); InputStream excludedFileContents = getClass().getClassLoader().getResourceAsStream(example + "/input_excluded_entity.java"); if (excludedFileContents != null) { IOUtils.copy(excludedFileContents, new FileOutputStream(excludedFile)); } IOUtils.copy(getClass().getClassLoader().getResourceAsStream(example + "/input_example_config.properties"), new FileOutputStream(exampleResource)); GradleRunner runner = GradleRunner.create(); runner = runner.withPluginClasspath().withDebug(true); List<String> args = new ArrayList<>(); args.add("build"); args.add("--stacktrace"); httpProxyArguments(args); runner = runner.withProjectDir(workingDir).withArguments(args).forwardOutput(); runner.build(); File exampleResourceOutputFile = new File(workingDir, "build/classes/java/main/example_config.properties"); Assert.assertTrue(exampleResourceOutputFile.exists()); }
Example #14
Source File: SystemdApplicationTest.java From gradle-plugins with Apache License 2.0 | 4 votes |
@Test public void check() throws IOException { File tempDir = new File("build/tmp"); tempDir.mkdirs(); testFolder = new TemporaryFolder(tempDir); testFolder.create(); workingDir = new File(testFolder.getRoot(), "demo"); workingDir.mkdirs(); File javaFolder = new File(workingDir, "src/main/java/example"); javaFolder.mkdirs(); File rpmFolder = new File(workingDir, "src/main/rpm"); rpmFolder.mkdirs(); System.setProperty("org.gradle.daemon", "false"); File gradleFile = new File(workingDir, "build.gradle"); File settingsFile = new File(workingDir, "settings.gradle"); File entityFile = new File(javaFolder, "Main.java"); File propertiesFile = new File(rpmFolder, "application.properties"); Assert.assertNotNull(getClass().getClassLoader().getResource("plugin-under-test-metadata.properties")); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("helm-app/input.gradle"), new FileOutputStream(gradleFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("helm-app/input_settings.gradle"), new FileOutputStream(settingsFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("helm-app/input_main.java"), new FileOutputStream(entityFile)); IOUtils.copy(getClass().getClassLoader().getResourceAsStream("helm-app/input_application.properties"), new FileOutputStream(propertiesFile)); GradleRunner runner = GradleRunner.create(); runner = runner.forwardOutput(); runner = runner.withPluginClasspath(); runner = runner.withProjectDir(workingDir).withArguments("buildRpm", "--stacktrace").forwardOutput(); runner.build(); File rpmFile = new File(workingDir, "build/distributions/demo.rpm"); Assert.assertTrue(rpmFile.exists()); File serviceFile = new File(workingDir, "build/systemd/services/demo-app.service"); Assert.assertTrue(serviceFile.exists()); String serviceDesc = IOUtils.toString(new FileInputStream(serviceFile)); Assert.assertTrue(serviceDesc.contains("ExecStart=/var/demo-app/bin/demo run")); }