Search in sources :

Example 11 with ProjectModel

use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.

the class ProjectResourceTest method beamFacet.

@Test
void beamFacet(final WebTarget target) throws IOException {
    final ProjectModel projectModel = new ProjectModel();
    projectModel.setPackageBase("com.foo");
    projectModel.setFacets(singletonList("Apache Beam"));
    {
        final ProjectModel.Source source = new ProjectModel.Source();
        source.setName("tIn");
        source.setGenericOutput(true);
        projectModel.setSources(singletonList(source));
    }
    {
        final ProjectModel.Processor proc = new ProjectModel.Processor();
        proc.setName("tIn");
        {
            final ProjectModel.NamedModel in = new ProjectModel.NamedModel();
            in.setName("__default__");
            in.setGeneric(true);
            proc.setInputStructures(singletonList(in));
        }
        proc.setOutputStructures(emptyList());
        projectModel.setProcessors(singletonList(proc));
    }
    final Map<String, String> files = createZip(projectModel, target);
    assertTrue(files.get("application/README.adoc").contains("=== Apache Beam"), files.toString());
    assertEquals(resourceFileToString("generated/ProjectResourceTest/beamFacet/TInMapperBeamTest.java"), files.get("application/src/test/java/com/foo/source/TInMapperBeamTest.java"));
    assertEquals(resourceFileToString("generated/ProjectResourceTest/beamFacet/TInOutputBeamTest.java"), files.get("application/src/test/java/com/foo/output/TInOutputBeamTest.java"));
}
Also used : Resources.resourceFileToString(org.talend.sdk.component.starter.server.service.Resources.resourceFileToString) ProjectModel(org.talend.sdk.component.starter.server.model.ProjectModel) Test(org.junit.jupiter.api.Test)

Example 12 with ProjectModel

use of org.talend.sdk.component.starter.server.model.ProjectModel in project component-runtime by Talend.

the class ProjectResourceTest method codenvyFacet.

@Test
void codenvyFacet(final WebTarget target) throws IOException {
    final ProjectModel projectModel = new ProjectModel();
    projectModel.setPackageBase("com.foo");
    projectModel.setFacets(singletonList("Codenvy"));
    final Map<String, String> files = createZip(projectModel, target);
    assertEquals(resourceFileToString("generated/ProjectResourceTest/codenvy/README.adoc").trim(), files.get("application/README.adoc").trim());
    assertEquals(resourceFileToString("generated/ProjectResourceTest/codenvy/codenvy.json"), files.get("application/.codenvy.json"));
}
Also used : Resources.resourceFileToString(org.talend.sdk.component.starter.server.service.Resources.resourceFileToString) ProjectModel(org.talend.sdk.component.starter.server.model.ProjectModel) Test(org.junit.jupiter.api.Test)

Aggregations

ProjectModel (org.talend.sdk.component.starter.server.model.ProjectModel)12 Test (org.junit.jupiter.api.Test)10 Resources.resourceFileToString (org.talend.sdk.component.starter.server.service.Resources.resourceFileToString)10 InputStream (java.io.InputStream)2 ZipInputStream (java.util.zip.ZipInputStream)2 BufferedInputStream (java.io.BufferedInputStream)1 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Writer (java.io.Writer)1 Annotation (java.lang.annotation.Annotation)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Files (java.nio.file.Files)1 StandardCopyOption (java.nio.file.StandardCopyOption)1 StandardOpenOption (java.nio.file.StandardOpenOption)1 ArrayList (java.util.ArrayList)1