use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.
the class ProjectResourceTest method emptyGradleProject.
@Test
void emptyGradleProject(final WebTarget target) throws IOException {
final ProjectModel projectModel = new ProjectModel();
projectModel.setBuildType("Gradle");
final Map<String, String> files = createZip(projectModel, target);
assertEquals(Stream.of("application/gradle/", "application/", "application/gradle/wrapper/gradle-wrapper.jar", "application/gradlew.bat", "application/gradlew", "application/gradle/wrapper/gradle-wrapper.properties", "application/gradle/wrapper/", "application/README.adoc", "application/build.gradle").collect(toSet()), files.keySet());
}
use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.
the class ProjectResourceTest method testingProject.
@Test
void testingProject(final WebTarget target) throws IOException {
final ProjectModel projectModel = new ProjectModel();
projectModel.setFacets(singletonList("Talend Component Kit Testing"));
// todo: add source/proc
final Map<String, String> files = createZip(projectModel, target);
assertEquals(Stream.of("application/", "application/src/test/resources/", "application/src/", "application/mvnw.cmd", "application/mvnw", "application/.mvn/", "application/.mvn/wrapper/maven-wrapper.properties", "application/.mvn/wrapper/", "application/.mvn/wrapper/maven-wrapper.jar", "application/src/test/", "application/src/test/resources/log4j2.xml", "application/pom.xml", "application/README.adoc").collect(toSet()), files.keySet());
Stream.of("component-api", "<source>1.8</source>", "<trimStackTrace>false</trimStackTrace>").forEach(token -> assertTrue(files.get("application/pom.xml").contains(token), token));
assertEquals("= A Talend generated Component Starter Project\n" + "\n" + "== Test\n" + "\n" + "=== Talend Component Kit Testing\n" + "\n" + "Talend Component Kit Testing skeleton generator. For each component selected it generates an associated test suffixed with `Test`.\n" + "\n" + "\n", files.get("application/README.adoc"));
}
use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.
the class ProjectResourceTest method travisFacet.
@Test
void travisFacet(final WebTarget target) throws IOException {
final ProjectModel projectModel = new ProjectModel();
projectModel.setFacets(singletonList("Travis CI"));
final Map<String, String> files = createZip(projectModel, target);
assertTrue(files.get("application/README.adoc").contains("=== Travis CI\n"));
assertTrue(files.get("application/.travis.yml").contains("language: java"));
}
use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.
the class ProjectResourceTest method emptyMavenProject.
@Test
void emptyMavenProject(final WebTarget target) throws IOException {
final ProjectModel projectModel = new ProjectModel();
final Map<String, String> files = createZip(projectModel, target);
assertEquals(Stream.of("application/.mvn/wrapper/", "application/mvnw.cmd", "application/", "application/mvnw", "application/.mvn/", "application/.mvn/wrapper/maven-wrapper.jar", "application/.mvn/wrapper/maven-wrapper.properties", "application/pom.xml", "application/README.adoc").collect(toSet()), files.keySet());
Stream.of("component-api", "<source>1.8</source>", "<trimStackTrace>false</trimStackTrace>").forEach(token -> assertTrue(files.get("application/pom.xml").contains(token), token));
assertEquals("= A Talend generated Component Starter Project\n", files.get("application/README.adoc"));
assertEquals(resourceFileToString("generated/ProjectResourceTest/emptyProject/pom.xml").replace("@runtime.version@", Versions.KIT).replace("@api.version@", Versions.API_KIT), files.get("application/pom.xml"));
}
use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.
the class ProjectResourceTest method wadlFacetGradle.
@Test
void wadlFacetGradle(final WebTarget target) throws IOException {
final ProjectModel projectModel = new ProjectModel();
projectModel.setBuildType("Gradle");
projectModel.setPackageBase("com.foo");
projectModel.setFacets(singletonList("WADL Client Generation"));
final Map<String, String> files = createZip(projectModel, target);
assertWadl(files);
Stream.of("apply plugin: 'nebula.provided-base'\n" + "apply plugin: 'org.talend.sdk.component'\n" + "apply plugin: 'java'\n" + "\n" + "tasks.withType(JavaCompile) {\n" + " sourceCompatibility = 1.8\n" + " targetCompatibility = 1.8\n" + " options.compilerArgs << '-parameters'\n" + " options.fork = true\n" + "}\n" + "\n" + "import org.apache.cxf.tools.common.ToolContext\n" + "import org.apache.cxf.tools.wadlto.WADLToJava\n" + "\n" + "buildscript {\n" + " repositories {\n" + " mavenLocal()\n" + " mavenCentral()\n" + " maven {\n" + " url \"https://plugins.gradle.org/m2/\"\n" + " }\n" + " }\n" + " dependencies {\n" + " classpath \"com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3\"\n" + " classpath \"org.talend.sdk.component:gradle-talend-component:" + Versions.KIT + "\"\n" + " classpath \"org.apache.cxf:cxf-tools-wadlto-jaxrs:3.2.4\"\n" + " }\n" + "}\n" + "\n" + "repositories {\n" + " mavenLocal()\n" + " mavenCentral()\n" + "}\n" + "\n" + "group = 'com.component'\n" + "description = 'An application generated by the Talend Component Kit Starter'\n" + "\n" + "jar {\n" + " baseName = 'application'\n" + " version = '0.0.1-SNAPSHOT'\n" + "}\n" + "\n" + "test {\n" + " testLogging.showStandardStreams = true\n" + "}\n" + "def wadlGeneratedFolder = \"$buildDir/generated-sources/cxf\"\n" + "task generateWadlClient {\n" + " def wadl = \"$projectDir/src/main/resources/wadl/client.xml\"\n" + "\n" + " inputs.file(wadl)\n" + " outputs.dir(wadlGeneratedFolder)\n" + "\n" + " doLast {\n" + " new File(wadlGeneratedFolder).mkdirs()\n" + "\n" + " new WADLToJava([\n" + " \"-d\", wadlGeneratedFolder,\n" + " \"-p\", \"com.application.client.wadl\",\n" + " wadl\n" + " ] as String[]).run(new ToolContext())\n" + " }\n" + "}\n" + "\n" + "sourceSets {\n" + " main {\n" + " java {\n" + " project.tasks.compileJava.dependsOn project.tasks.generateWadlClient\n" + " srcDir wadlGeneratedFolder\n" + " }\n" + " }\n" + "}\n" + "\n" + "repositories {\n" + " mavenCentral()\n" + "}\n" + "\n" + "dependencies {\n" + " provided group: 'org.talend.sdk.component', name: 'component-api', version: '" + Versions.API_KIT + "'\n" + " compile group: 'org.apache.cxf', name: 'cxf-rt-rs-client', version: '3.2.4'\n" + "}").forEach(string -> assertTrue(files.get("application/build.gradle").contains(string), string));
}
Aggregations