Skip to content

Commit dbcec70

Browse files
committed
Fixed regression because of issue #11.
1 parent 5a7abd6 commit dbcec70

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

tests/issues/src/test/java/org/jvnet/jaxb2_commons/tests/issues/JIIB36Test.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.jvnet.jaxb2_commons.tests.issues;
22

3-
import junit.framework.Assert;
4-
import junit.framework.TestCase;
3+
import org.junit.Assert;
4+
import org.junit.Test;
55

6-
public class JIIB36Test extends TestCase {
6+
public class JIIB36Test {
77

8-
public void testException() throws Exception {
8+
@Test
9+
public void runsWithoutException() {
910

1011
final IssueJIIB36 one = new IssueJIIB36();
1112
final IssueJIIB36 two = new IssueJIIB36();
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.jvnet.jaxb2_commons.tests.issues;
2+
3+
import java.io.File;
4+
import java.net.URL;
5+
6+
import org.junit.Before;
7+
import org.junit.Test;
8+
9+
import com.sun.codemodel.JCodeModel;
10+
import com.sun.tools.xjc.ConsoleErrorReporter;
11+
import com.sun.tools.xjc.ModelLoader;
12+
import com.sun.tools.xjc.Options;
13+
import com.sun.tools.xjc.model.Model;
14+
15+
public class RunPlugins {
16+
17+
@Before
18+
public void setUp() {
19+
System.setProperty("javax.xml.accessExternalSchema", "all");
20+
}
21+
22+
@Test
23+
public void compilesSchema() throws Exception {
24+
25+
new File("target/generated-sources/xjc").mkdirs();
26+
27+
URL schema = getClass().getResource("/schema.xsd");
28+
URL binding = getClass().getResource("/binding.xjb");
29+
final String[] arguments = new String[] { "-xmlschema",
30+
schema.toExternalForm(), "-b", binding.toExternalForm(), "-d",
31+
"target/generated-sources/xjc", "-extension", "-XhashCode",
32+
"-Xequals", "-XtoString", "-Xcopyable", "-Xmergeable", "-Xinheritance", "-Xwildcard"
33+
// "-XsimpleToString"
34+
35+
};
36+
37+
Options options = new Options();
38+
options.parseArguments(arguments);
39+
ConsoleErrorReporter receiver = new ConsoleErrorReporter();
40+
Model model = ModelLoader.load(options, new JCodeModel(), receiver);
41+
model.generateCode(options, receiver);
42+
com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
43+
model.codeModel.build(cw);
44+
}
45+
}

0 commit comments

Comments
 (0)