From 3d72fd9a506f1ff8297fb001454b3b44c3de5257 Mon Sep 17 00:00:00 2001 From: Gintas Grigelionis Date: Mon, 12 Mar 2018 19:31:45 +0100 Subject: [PATCH] Add sources for Hello World tutorial --- manual/tutorial-HelloWorldWithAnt.html | 2 +- src/tutorial/hello-world/01-simple/build.xml | 37 +++++++++ .../01-simple/src/oata/HelloWorld.java | 7 ++ src/tutorial/hello-world/02-logging/build.xml | 47 ++++++++++++ .../02-logging/src/oata/HelloWorld.java | 13 ++++ src/tutorial/hello-world/03-testing/build.xml | 64 ++++++++++++++++ .../03-testing/src/log4j.properties | 6 ++ .../03-testing/src/oata/HelloWorld.java | 11 +++ .../03-testing/src/oata/HelloWorldTest.java | 18 +++++ src/tutorial/hello-world/final/build.xml | 75 +++++++++++++++++++ .../hello-world/final/src/log4j.properties | 6 ++ .../final/src/oata/HelloWorld.java | 11 +++ .../final/src/oata/HelloWorldTest.java | 18 +++++ 13 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 src/tutorial/hello-world/01-simple/build.xml create mode 100644 src/tutorial/hello-world/01-simple/src/oata/HelloWorld.java create mode 100644 src/tutorial/hello-world/02-logging/build.xml create mode 100644 src/tutorial/hello-world/02-logging/src/oata/HelloWorld.java create mode 100644 src/tutorial/hello-world/03-testing/build.xml create mode 100644 src/tutorial/hello-world/03-testing/src/log4j.properties create mode 100644 src/tutorial/hello-world/03-testing/src/oata/HelloWorld.java create mode 100644 src/tutorial/hello-world/03-testing/src/oata/HelloWorldTest.java create mode 100644 src/tutorial/hello-world/final/build.xml create mode 100644 src/tutorial/hello-world/final/src/log4j.properties create mode 100644 src/tutorial/hello-world/final/src/oata/HelloWorld.java create mode 100644 src/tutorial/hello-world/final/src/oata/HelloWorldTest.java diff --git a/manual/tutorial-HelloWorldWithAnt.html b/manual/tutorial-HelloWorldWithAnt.html index b349babdc..5b02d6a67 100644 --- a/manual/tutorial-HelloWorldWithAnt.html +++ b/manual/tutorial-HelloWorldWithAnt.html @@ -409,7 +409,7 @@ junit instruction to our buildfile:

</classpath> <batchtest fork="yes"> - <fileset dir="${src.dir}" includes="*Test.java"/> + <fileset dir="${src.dir}" includes="**/*Test.java"/> </batchtest> </junit> </target> diff --git a/src/tutorial/hello-world/01-simple/build.xml b/src/tutorial/hello-world/01-simple/build.xml new file mode 100644 index 000000000..2da99b083 --- /dev/null +++ b/src/tutorial/hello-world/01-simple/build.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tutorial/hello-world/01-simple/src/oata/HelloWorld.java b/src/tutorial/hello-world/01-simple/src/oata/HelloWorld.java new file mode 100644 index 000000000..b2e723090 --- /dev/null +++ b/src/tutorial/hello-world/01-simple/src/oata/HelloWorld.java @@ -0,0 +1,7 @@ +package oata; + +public class HelloWorld { + public static void main(String[] args) { + System.out.println("Hello World"); + } +} diff --git a/src/tutorial/hello-world/02-logging/build.xml b/src/tutorial/hello-world/02-logging/build.xml new file mode 100644 index 000000000..8206cc81e --- /dev/null +++ b/src/tutorial/hello-world/02-logging/build.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tutorial/hello-world/02-logging/src/oata/HelloWorld.java b/src/tutorial/hello-world/02-logging/src/oata/HelloWorld.java new file mode 100644 index 000000000..751dcc9bc --- /dev/null +++ b/src/tutorial/hello-world/02-logging/src/oata/HelloWorld.java @@ -0,0 +1,13 @@ +package oata; + +import org.apache.log4j.Logger; +import org.apache.log4j.BasicConfigurator; + +public class HelloWorld { + static Logger logger = Logger.getLogger(HelloWorld.class); + + public static void main(String[] args) { + BasicConfigurator.configure(); + logger.info("Hello World"); // the old System.out-statement + } +} diff --git a/src/tutorial/hello-world/03-testing/build.xml b/src/tutorial/hello-world/03-testing/build.xml new file mode 100644 index 000000000..9ebe9ba9b --- /dev/null +++ b/src/tutorial/hello-world/03-testing/build.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tutorial/hello-world/03-testing/src/log4j.properties b/src/tutorial/hello-world/03-testing/src/log4j.properties new file mode 100644 index 000000000..111e080de --- /dev/null +++ b/src/tutorial/hello-world/03-testing/src/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=DEBUG, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender + +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%m%n diff --git a/src/tutorial/hello-world/03-testing/src/oata/HelloWorld.java b/src/tutorial/hello-world/03-testing/src/oata/HelloWorld.java new file mode 100644 index 000000000..73c32293d --- /dev/null +++ b/src/tutorial/hello-world/03-testing/src/oata/HelloWorld.java @@ -0,0 +1,11 @@ +package oata; + +import org.apache.log4j.Logger; + +public class HelloWorld { + static Logger logger = Logger.getLogger(HelloWorld.class); + + public static void main(String[] args) { + logger.info("Hello World"); // the old System.out-statement + } +} diff --git a/src/tutorial/hello-world/03-testing/src/oata/HelloWorldTest.java b/src/tutorial/hello-world/03-testing/src/oata/HelloWorldTest.java new file mode 100644 index 000000000..d08244fca --- /dev/null +++ b/src/tutorial/hello-world/03-testing/src/oata/HelloWorldTest.java @@ -0,0 +1,18 @@ +package oata; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class HelloWorldTest { + + @Test + public void testNothing() { + } + + @Test + public void testWillAlwaysFail() { + fail("An error message"); + } + +} diff --git a/src/tutorial/hello-world/final/build.xml b/src/tutorial/hello-world/final/build.xml new file mode 100644 index 000000000..d2f25fb26 --- /dev/null +++ b/src/tutorial/hello-world/final/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tutorial/hello-world/final/src/log4j.properties b/src/tutorial/hello-world/final/src/log4j.properties new file mode 100644 index 000000000..111e080de --- /dev/null +++ b/src/tutorial/hello-world/final/src/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=DEBUG, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender + +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%m%n diff --git a/src/tutorial/hello-world/final/src/oata/HelloWorld.java b/src/tutorial/hello-world/final/src/oata/HelloWorld.java new file mode 100644 index 000000000..73c32293d --- /dev/null +++ b/src/tutorial/hello-world/final/src/oata/HelloWorld.java @@ -0,0 +1,11 @@ +package oata; + +import org.apache.log4j.Logger; + +public class HelloWorld { + static Logger logger = Logger.getLogger(HelloWorld.class); + + public static void main(String[] args) { + logger.info("Hello World"); // the old System.out-statement + } +} diff --git a/src/tutorial/hello-world/final/src/oata/HelloWorldTest.java b/src/tutorial/hello-world/final/src/oata/HelloWorldTest.java new file mode 100644 index 000000000..d08244fca --- /dev/null +++ b/src/tutorial/hello-world/final/src/oata/HelloWorldTest.java @@ -0,0 +1,18 @@ +package oata; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +public class HelloWorldTest { + + @Test + public void testNothing() { + } + + @Test + public void testWillAlwaysFail() { + fail("An error message"); + } + +}