You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2015/04/18 22:26:48 UTC
[18/22] ant git commit: fix some lineends
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
index 14a0966..207dda6 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/SuiteMethodTest.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-
-/**
- * validates that the suite() method works in classes that don't
- * implement Test.
- */
-public class SuiteMethodTest {
-
- public static Test suite() {
- return new Nested("testMethod");
- }
-
- public static class Nested extends TestCase {
- public Nested(String name) {
- super(name);
- }
-
- public void testMethod() {
- assertTrue(true);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+/**
+ * validates that the suite() method works in classes that don't
+ * implement Test.
+ */
+public class SuiteMethodTest {
+
+ public static Test suite() {
+ return new Nested("testMethod");
+ }
+
+ public static class Nested extends TestCase {
+ public Nested(String name) {
+ super(name);
+ }
+
+ public void testMethod() {
+ assertTrue(true);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
index a85d9fe..bfc6d31 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TearDownOnVmCrashTest.java
@@ -1,53 +1,53 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import static org.apache.tools.ant.AntAssert.assertContains;
-import static org.apache.tools.ant.AntAssert.assertNotContains;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class TearDownOnVmCrashTest {
-
- @Rule
- public BuildFileRule buildRule = new BuildFileRule();
-
- @Before
- public void setUp() {
- buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit/teardownlistener.xml");
- }
-
- @Test
- public void testNoTeardown() {
- buildRule.executeTarget("testNoTeardown");
- assertEquals("true", buildRule.getProject().getProperty("error"));
- assertNotContains("tearDown called on Timeout", buildRule.getOutput());
- }
-
- @Test
- public void testTeardown() {
- buildRule.executeTarget("testTeardown");
- assertEquals("true", buildRule.getProject().getProperty("error"));
- assertContains("tearDown called on Timeout", buildRule.getOutput());
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.apache.tools.ant.AntAssert.assertNotContains;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class TearDownOnVmCrashTest {
+
+ @Rule
+ public BuildFileRule buildRule = new BuildFileRule();
+
+ @Before
+ public void setUp() {
+ buildRule.configureProject("src/etc/testcases/taskdefs/optional/junit/teardownlistener.xml");
+ }
+
+ @Test
+ public void testNoTeardown() {
+ buildRule.executeTarget("testNoTeardown");
+ assertEquals("true", buildRule.getProject().getProperty("error"));
+ assertNotContains("tearDown called on Timeout", buildRule.getOutput());
+ }
+
+ @Test
+ public void testTeardown() {
+ buildRule.executeTarget("testTeardown");
+ assertEquals("true", buildRule.getProject().getProperty("error"));
+ assertContains("tearDown called on Timeout", buildRule.getOutput());
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
index 27420d6..d40da0b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/TestFormatter.java
@@ -1,112 +1,112 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-
-import org.apache.tools.ant.BuildException;
-
-public class TestFormatter implements JUnitResultFormatter {
-
- private static final byte[] grafitto = new byte[] {
- (byte) 'T', (byte) 'e', (byte) 's', (byte) 't', (byte) 'F', (byte) 'o',
- (byte) 'r', (byte) 'm', (byte) 'a', (byte) 't', (byte) 't', (byte) 'e',
- (byte) 'r', (byte) ' ', (byte) 'w', (byte) 'a', (byte) 's', (byte) ' ',
- (byte) 'h', (byte) 'e', (byte) 'r', (byte) 'e', 10
- };
-
- /**
- * Where to write the log to.
- */
- private OutputStream out;
-
- /**
- * Empty
- */
- public TestFormatter() {
- }
-
- /**
- * Empty
- */
- public void startTestSuite(JUnitTest suite) {
- }
- /**
- * Empty
- */
- public void startTest(Test t) {
- }
- /**
- * Empty
- */
- public void endTest(Test test) {
- }
- /**
- * Empty
- */
- public void addFailure(Test test, Throwable t) {
- }
- /**
- * Empty
- */
- public void addFailure(Test test, AssertionFailedError t) {
- }
- /**
- * Empty
- */
- public void addError(Test test, Throwable t) {
- }
- /**
- * Empty
- */
- public void setSystemOutput(String out) {
- }
- /**
- * Empty
- */
- public void setSystemError(String err) {
- }
-
- public void setOutput(OutputStream out) {
- this.out = out;
- }
-
- public void endTestSuite(JUnitTest suite) throws BuildException {
- if (out != null) {
- try {
- out.write(grafitto);
- out.flush();
- } catch (IOException ioex) {
- throw new BuildException("Unable to write output", ioex);
- } finally {
- if (out != System.out && out != System.err) {
- try {
- out.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+
+import org.apache.tools.ant.BuildException;
+
+public class TestFormatter implements JUnitResultFormatter {
+
+ private static final byte[] grafitto = new byte[] {
+ (byte) 'T', (byte) 'e', (byte) 's', (byte) 't', (byte) 'F', (byte) 'o',
+ (byte) 'r', (byte) 'm', (byte) 'a', (byte) 't', (byte) 't', (byte) 'e',
+ (byte) 'r', (byte) ' ', (byte) 'w', (byte) 'a', (byte) 's', (byte) ' ',
+ (byte) 'h', (byte) 'e', (byte) 'r', (byte) 'e', 10
+ };
+
+ /**
+ * Where to write the log to.
+ */
+ private OutputStream out;
+
+ /**
+ * Empty
+ */
+ public TestFormatter() {
+ }
+
+ /**
+ * Empty
+ */
+ public void startTestSuite(JUnitTest suite) {
+ }
+ /**
+ * Empty
+ */
+ public void startTest(Test t) {
+ }
+ /**
+ * Empty
+ */
+ public void endTest(Test test) {
+ }
+ /**
+ * Empty
+ */
+ public void addFailure(Test test, Throwable t) {
+ }
+ /**
+ * Empty
+ */
+ public void addFailure(Test test, AssertionFailedError t) {
+ }
+ /**
+ * Empty
+ */
+ public void addError(Test test, Throwable t) {
+ }
+ /**
+ * Empty
+ */
+ public void setSystemOutput(String out) {
+ }
+ /**
+ * Empty
+ */
+ public void setSystemError(String err) {
+ }
+
+ public void setOutput(OutputStream out) {
+ this.out = out;
+ }
+
+ public void endTestSuite(JUnitTest suite) throws BuildException {
+ if (out != null) {
+ try {
+ out.write(grafitto);
+ out.flush();
+ } catch (IOException ioex) {
+ throw new BuildException("Unable to write output", ioex);
+ } finally {
+ if (out != System.out && out != System.err) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
index 92d21b6..9c5e589 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/VmCrash.java
@@ -1,31 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import org.junit.Test;
-
-/**
- */
-public class VmCrash {
-
- @Test
- public void testCrash() {
- System.exit(0);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import org.junit.Test;
+
+/**
+ */
+public class VmCrash {
+
+ @Test
+ public void testCrash() {
+ System.exit(0);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
index 3f464d8..f28bf72 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLFormatterWithCDATAOnSystemOut.java
@@ -1,83 +1,83 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import org.apache.tools.ant.BuildFileRule;
-import org.apache.tools.ant.util.FileUtils;
-import org.junit.Rule;
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-public class XMLFormatterWithCDATAOnSystemOut {
-
- private static final String DIR = "src/etc/testcases/taskdefs/optional/junit";
- private static final String REPORT =
- "TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml";
-
- private static final String TESTDATA =
- "<ERROR>" +
- "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
- " <RESPONSE>" +
- " <GDS/>" +
- " <ERROR>" +
- " <ID/>" +
- " <MESSAGE/>" +
- " <REQUEST_TYPE/>" +
- " <RESEND/>" +
- " <RAW_RESPONSE/>" +
- " </ERROR>" +
- " </RESPONSE>" +
- "]]>" +
- "</ERROR>";
-
- @Rule
- public BuildFileRule buildRule = new BuildFileRule();
-
- @Test
- public void testOutput() {
- System.out.println(TESTDATA);
- }
-
- @Test
- public void testBuildfile() throws IOException {
- buildRule.configureProject(DIR + "/cdataoutput.xml");
- if (buildRule.getProject().getProperty("cdata.inner") == null) {
- // avoid endless loop
- buildRule.executeTarget("run-junit");
- File f = buildRule.getProject().resolveFile(REPORT);
- FileReader reader = null;
- try {
- reader = new FileReader(f);
- String content = FileUtils.readFully(reader);
- assertTrue(content.indexOf("</RESPONSE>]]>"
- + "</ERROR>") > 0);
- } finally {
- if (reader != null) {
- reader.close();
- }
- f.delete();
- }
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildFileRule;
+import org.apache.tools.ant.util.FileUtils;
+import org.junit.Rule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class XMLFormatterWithCDATAOnSystemOut {
+
+ private static final String DIR = "src/etc/testcases/taskdefs/optional/junit";
+ private static final String REPORT =
+ "TEST-" + XMLFormatterWithCDATAOnSystemOut.class.getName() + ".xml";
+
+ private static final String TESTDATA =
+ "<ERROR>" +
+ "<![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ " <RESPONSE>" +
+ " <GDS/>" +
+ " <ERROR>" +
+ " <ID/>" +
+ " <MESSAGE/>" +
+ " <REQUEST_TYPE/>" +
+ " <RESEND/>" +
+ " <RAW_RESPONSE/>" +
+ " </ERROR>" +
+ " </RESPONSE>" +
+ "]]>" +
+ "</ERROR>";
+
+ @Rule
+ public BuildFileRule buildRule = new BuildFileRule();
+
+ @Test
+ public void testOutput() {
+ System.out.println(TESTDATA);
+ }
+
+ @Test
+ public void testBuildfile() throws IOException {
+ buildRule.configureProject(DIR + "/cdataoutput.xml");
+ if (buildRule.getProject().getProperty("cdata.inner") == null) {
+ // avoid endless loop
+ buildRule.executeTarget("run-junit");
+ File f = buildRule.getProject().resolveFile(REPORT);
+ FileReader reader = null;
+ try {
+ reader = new FileReader(f);
+ String content = FileUtils.readFully(reader);
+ assertTrue(content.indexOf("</RESPONSE>]]>"
+ + "</ERROR>") > 0);
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ f.delete();
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ant/blob/1ae68097/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
index da67fec..095a2f0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregatorTest.java
@@ -1,93 +1,93 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.tools.ant.taskdefs.optional.junit;
-
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.PrintWriter;
-import java.security.Permission;
-
-import org.apache.tools.ant.DefaultLogger;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Delete;
-import org.apache.tools.ant.types.FileSet;
-import org.junit.Assume;
-import org.junit.Test;
-
-public class XMLResultAggregatorTest {
-
- @Test
- public void testFrames() throws Exception {
- // For now, skip this test on JDK 6 (and below); see below for why:
- try {
- Class.forName("java.nio.file.Files");
- } catch (ClassNotFoundException x) {
- Assume.assumeNoException("Skip test on JDK 6 and below", x);
- }
- final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
- if (d.exists()) {
- new Delete() {{removeDir(d);}}; // is there no utility method for this?
- }
- assertTrue(d.getAbsolutePath(), d.mkdir());
- File xml = new File(d, "x.xml");
- PrintWriter pw = new PrintWriter(new FileOutputStream(xml));
- try {
- pw.println("<testsuite errors='0' failures='0' name='my.UnitTest' tests='1'>");
- pw.println(" <testcase classname='my.UnitTest' name='testSomething'/>");
- pw.println("</testsuite>");
- pw.flush();
- } finally {
- pw.close();
- }
- XMLResultAggregator task = new XMLResultAggregator();
- task.setTodir(d);
- Project project = new Project();
- DefaultLogger logger = new DefaultLogger();
- logger.setOutputPrintStream(System.out);
- logger.setErrorPrintStream(System.err);
- logger.setMessageOutputLevel(Project.MSG_INFO);
- project.addBuildListener(logger);
- project.init();
- task.setProject(project);
- AggregateTransformer report = task.createReport();
- report.setTodir(d);
- FileSet fs = new FileSet();
- fs.setFile(xml);
- task.addFileSet(fs);
- /* getResourceAsStream override unnecessary on JDK 7. Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
- Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
- public InputStream getResourceAsStream(String name) {
- if (name.startsWith("META-INF/services/")) {
- return new ByteArrayInputStream(new byte[0]);
- }
- return super.getResourceAsStream(name);
- }
- });
- */
- // Use the JRE's Xerces, not lib/optional/xerces.jar:
- Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
- // Tickle #51668:
- System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
- task.execute();
- assertTrue(new File(d, "index.html").isFile());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.tools.ant.taskdefs.optional.junit;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.security.Permission;
+
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Delete;
+import org.apache.tools.ant.types.FileSet;
+import org.junit.Assume;
+import org.junit.Test;
+
+public class XMLResultAggregatorTest {
+
+ @Test
+ public void testFrames() throws Exception {
+ // For now, skip this test on JDK 6 (and below); see below for why:
+ try {
+ Class.forName("java.nio.file.Files");
+ } catch (ClassNotFoundException x) {
+ Assume.assumeNoException("Skip test on JDK 6 and below", x);
+ }
+ final File d = new File(System.getProperty("java.io.tmpdir"), "XMLResultAggregatorTest");
+ if (d.exists()) {
+ new Delete() {{removeDir(d);}}; // is there no utility method for this?
+ }
+ assertTrue(d.getAbsolutePath(), d.mkdir());
+ File xml = new File(d, "x.xml");
+ PrintWriter pw = new PrintWriter(new FileOutputStream(xml));
+ try {
+ pw.println("<testsuite errors='0' failures='0' name='my.UnitTest' tests='1'>");
+ pw.println(" <testcase classname='my.UnitTest' name='testSomething'/>");
+ pw.println("</testsuite>");
+ pw.flush();
+ } finally {
+ pw.close();
+ }
+ XMLResultAggregator task = new XMLResultAggregator();
+ task.setTodir(d);
+ Project project = new Project();
+ DefaultLogger logger = new DefaultLogger();
+ logger.setOutputPrintStream(System.out);
+ logger.setErrorPrintStream(System.err);
+ logger.setMessageOutputLevel(Project.MSG_INFO);
+ project.addBuildListener(logger);
+ project.init();
+ task.setProject(project);
+ AggregateTransformer report = task.createReport();
+ report.setTodir(d);
+ FileSet fs = new FileSet();
+ fs.setFile(xml);
+ task.addFileSet(fs);
+ /* getResourceAsStream override unnecessary on JDK 7. Ought to work around JAXP #6723276 in JDK 6, but causes a TypeCheckError in FunctionCall for reasons TBD:
+ Thread.currentThread().setContextClassLoader(new ClassLoader(ClassLoader.getSystemClassLoader().getParent()) {
+ public InputStream getResourceAsStream(String name) {
+ if (name.startsWith("META-INF/services/")) {
+ return new ByteArrayInputStream(new byte[0]);
+ }
+ return super.getResourceAsStream(name);
+ }
+ });
+ */
+ // Use the JRE's Xerces, not lib/optional/xerces.jar:
+ Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader().getParent());
+ // Tickle #51668:
+ System.setSecurityManager(new SecurityManager() {public void checkPermission(Permission perm) {}});
+ task.execute();
+ assertTrue(new File(d, "index.html").isFile());
+ }
+
+}