jaroslav@1202: /** jaroslav@1202: * HTML via Java(tm) Language Bindings jaroslav@1202: * Copyright (C) 2013 Jaroslav Tulach jaroslav@1202: * jaroslav@1202: * This program is free software: you can redistribute it and/or modify jaroslav@1202: * it under the terms of the GNU General Public License as published by jaroslav@1202: * the Free Software Foundation, version 2 of the License. jaroslav@1202: * jaroslav@1202: * This program is distributed in the hope that it will be useful, jaroslav@1202: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@1202: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@1202: * GNU General Public License for more details. apidesign.org jaroslav@1202: * designates this particular file as subject to the jaroslav@1202: * "Classpath" exception as provided by apidesign.org jaroslav@1202: * in the License file that accompanied this code. jaroslav@1202: * jaroslav@1202: * You should have received a copy of the GNU General Public License jaroslav@1202: * along with this program. Look for COPYING file in the top folder. jaroslav@1202: * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException jaroslav@1202: */ jaroslav@1202: package org.apidesign.html.archetype.test; jaroslav@1202: jaroslav@1202: import java.io.File; jaroslav@1202: import java.util.Properties; jaroslav@1202: import org.apache.maven.it.Verifier; jaroslav@1202: import org.testng.annotations.Test; jaroslav@1202: import static org.testng.Assert.*; jaroslav@1202: jaroslav@1202: /** jaroslav@1202: * jaroslav@1202: * @author Jaroslav Tulach jaroslav@1202: */ jaroslav@1202: public class VerifyArchetypeTest { jaroslav@1202: @Test public void fxBrwsrCompiles() throws Exception { jaroslav@1202: final File dir = new File("target/tests/fxcompile/").getAbsoluteFile(); jaroslav@1202: generateFromArchetype(dir); jaroslav@1202: jaroslav@1202: File created = new File(dir, "o-a-test"); jaroslav@1202: assertTrue(created.isDirectory(), "Project created"); jaroslav@1202: assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there"); jaroslav@1202: jaroslav@1202: Verifier v = new Verifier(created.getAbsolutePath()); jaroslav@1202: v.executeGoal("verify"); jaroslav@1202: jaroslav@1202: v.verifyErrorFreeLog(); jaroslav@1202: } jaroslav@1202: jaroslav@1202: private Verifier generateFromArchetype(final File dir) throws Exception { jaroslav@1202: Verifier v = new Verifier(dir.getAbsolutePath()); jaroslav@1202: v.setAutoclean(false); jaroslav@1202: v.deleteDirectory(""); jaroslav@1202: dir.mkdirs(); jaroslav@1202: Properties sysProp = v.getSystemProperties(); jaroslav@1202: sysProp.put("groupId", "org.apidesign.test"); jaroslav@1202: sysProp.put("artifactId", "o-a-test"); jaroslav@1202: sysProp.put("package", "org.apidesign.test.oat"); jaroslav@1202: sysProp.put("archetypeGroupId", "org.apidesign.html"); jaroslav@1202: sysProp.put("archetypeArtifactId", "knockout4j-archetype"); jaroslav@1202: sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion()); jaroslav@1202: v.executeGoal("archetype:generate"); jaroslav@1202: v.verifyErrorFreeLog(); jaroslav@1202: return v; jaroslav@1202: } jaroslav@1202: }