jaroslav@1202
|
1 |
/**
|
jaroslav@1202
|
2 |
* HTML via Java(tm) Language Bindings
|
jaroslav@1202
|
3 |
* Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
|
jaroslav@1202
|
4 |
*
|
jaroslav@1202
|
5 |
* This program is free software: you can redistribute it and/or modify
|
jaroslav@1202
|
6 |
* it under the terms of the GNU General Public License as published by
|
jaroslav@1202
|
7 |
* the Free Software Foundation, version 2 of the License.
|
jaroslav@1202
|
8 |
*
|
jaroslav@1202
|
9 |
* This program is distributed in the hope that it will be useful,
|
jaroslav@1202
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jaroslav@1202
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jaroslav@1202
|
12 |
* GNU General Public License for more details. apidesign.org
|
jaroslav@1202
|
13 |
* designates this particular file as subject to the
|
jaroslav@1202
|
14 |
* "Classpath" exception as provided by apidesign.org
|
jaroslav@1202
|
15 |
* in the License file that accompanied this code.
|
jaroslav@1202
|
16 |
*
|
jaroslav@1202
|
17 |
* You should have received a copy of the GNU General Public License
|
jaroslav@1202
|
18 |
* along with this program. Look for COPYING file in the top folder.
|
jaroslav@1202
|
19 |
* If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
|
jaroslav@1202
|
20 |
*/
|
jaroslav@1202
|
21 |
package org.apidesign.html.archetype.test;
|
jaroslav@1202
|
22 |
|
jaroslav@1202
|
23 |
import java.io.File;
|
jaroslav@1202
|
24 |
import java.util.Properties;
|
jaroslav@1202
|
25 |
import org.apache.maven.it.Verifier;
|
jaroslav@1202
|
26 |
import org.testng.annotations.Test;
|
jaroslav@1202
|
27 |
import static org.testng.Assert.*;
|
jaroslav@1202
|
28 |
|
jaroslav@1202
|
29 |
/**
|
jaroslav@1202
|
30 |
*
|
jaroslav@1202
|
31 |
* @author Jaroslav Tulach <jtulach@netbeans.org>
|
jaroslav@1202
|
32 |
*/
|
jaroslav@1202
|
33 |
public class VerifyArchetypeTest {
|
jaroslav@1202
|
34 |
@Test public void fxBrwsrCompiles() throws Exception {
|
jaroslav@1202
|
35 |
final File dir = new File("target/tests/fxcompile/").getAbsoluteFile();
|
jaroslav@1202
|
36 |
generateFromArchetype(dir);
|
jaroslav@1202
|
37 |
|
jaroslav@1202
|
38 |
File created = new File(dir, "o-a-test");
|
jaroslav@1202
|
39 |
assertTrue(created.isDirectory(), "Project created");
|
jaroslav@1202
|
40 |
assertTrue(new File(created, "pom.xml").isFile(), "Pom file is in there");
|
jaroslav@1202
|
41 |
|
jaroslav@1202
|
42 |
Verifier v = new Verifier(created.getAbsolutePath());
|
jaroslav@1202
|
43 |
v.executeGoal("verify");
|
jaroslav@1202
|
44 |
|
jaroslav@1202
|
45 |
v.verifyErrorFreeLog();
|
jaroslav@1202
|
46 |
}
|
jaroslav@1202
|
47 |
|
jaroslav@1202
|
48 |
private Verifier generateFromArchetype(final File dir) throws Exception {
|
jaroslav@1202
|
49 |
Verifier v = new Verifier(dir.getAbsolutePath());
|
jaroslav@1202
|
50 |
v.setAutoclean(false);
|
jaroslav@1202
|
51 |
v.deleteDirectory("");
|
jaroslav@1202
|
52 |
dir.mkdirs();
|
jaroslav@1202
|
53 |
Properties sysProp = v.getSystemProperties();
|
jaroslav@1202
|
54 |
sysProp.put("groupId", "org.apidesign.test");
|
jaroslav@1202
|
55 |
sysProp.put("artifactId", "o-a-test");
|
jaroslav@1202
|
56 |
sysProp.put("package", "org.apidesign.test.oat");
|
jaroslav@1202
|
57 |
sysProp.put("archetypeGroupId", "org.apidesign.html");
|
jaroslav@1202
|
58 |
sysProp.put("archetypeArtifactId", "knockout4j-archetype");
|
jaroslav@1202
|
59 |
sysProp.put("archetypeVersion", ArchetypeVersionTest.findCurrentVersion());
|
jaroslav@1202
|
60 |
v.executeGoal("archetype:generate");
|
jaroslav@1202
|
61 |
v.verifyErrorFreeLog();
|
jaroslav@1202
|
62 |
return v;
|
jaroslav@1202
|
63 |
}
|
jaroslav@1202
|
64 |
}
|