ko-archetype-test/src/test/java/org/apidesign/html/archetype/test/VerifyArchetypeTest.java
changeset 1202 5f04bdbc6ee1
child 1203 eaa7c421a09e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ko-archetype-test/src/test/java/org/apidesign/html/archetype/test/VerifyArchetypeTest.java	Mon May 13 14:25:37 2013 +0200
     1.3 @@ -0,0 +1,64 @@
     1.4 +/**
     1.5 + * HTML via Java(tm) Language Bindings
     1.6 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.7 + *
     1.8 + * This program is free software: you can redistribute it and/or modify
     1.9 + * it under the terms of the GNU General Public License as published by
    1.10 + * the Free Software Foundation, version 2 of the License.
    1.11 + *
    1.12 + * This program is distributed in the hope that it will be useful,
    1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 + * GNU General Public License for more details. apidesign.org
    1.16 + * designates this particular file as subject to the
    1.17 + * "Classpath" exception as provided by apidesign.org
    1.18 + * in the License file that accompanied this code.
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License
    1.21 + * along with this program. Look for COPYING file in the top folder.
    1.22 + * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
    1.23 + */
    1.24 +package org.apidesign.html.archetype.test;
    1.25 +
    1.26 +import java.io.File;
    1.27 +import java.util.Properties;
    1.28 +import org.apache.maven.it.Verifier;
    1.29 +import org.testng.annotations.Test;
    1.30 +import static org.testng.Assert.*;
    1.31 +
    1.32 +/**
    1.33 + *
    1.34 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.35 + */
    1.36 +public class VerifyArchetypeTest {
    1.37 +    @Test public void fxBrwsrCompiles() throws Exception {
    1.38 +        final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
    1.39 +        generateFromArchetype(dir);
    1.40 +        
    1.41 +        File created = new File(dir, "o-a-test");
    1.42 +        assertTrue(created.isDirectory(), "Project created");
    1.43 +        assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
    1.44 +        
    1.45 +        Verifier v = new Verifier(created.getAbsolutePath());
    1.46 +        v.executeGoal("verify");
    1.47 +        
    1.48 +        v.verifyErrorFreeLog();
    1.49 +    }
    1.50 +
    1.51 +    private Verifier generateFromArchetype(final File dir) throws Exception {
    1.52 +        Verifier v = new Verifier(dir.getAbsolutePath());
    1.53 +        v.setAutoclean(false);
    1.54 +        v.deleteDirectory("");
    1.55 +        dir.mkdirs();
    1.56 +        Properties sysProp = v.getSystemProperties();
    1.57 +        sysProp.put("groupId", "org.apidesign.test");
    1.58 +        sysProp.put("artifactId", "o-a-test");
    1.59 +        sysProp.put("package", "org.apidesign.test.oat");
    1.60 +        sysProp.put("archetypeGroupId", "org.apidesign.html");
    1.61 +        sysProp.put("archetypeArtifactId", "knockout4j-archetype");
    1.62 +        sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion());
    1.63 +        v.executeGoal("archetype:generate");
    1.64 +        v.verifyErrorFreeLog();
    1.65 +        return v;
    1.66 +    }
    1.67 +}