diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..2ed83a6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,68 @@ + + 4.0.0 + raffbrains + myweb + war + 0.0.12 + my-app + http://maven.apache.org + + + + org.apache.poi + poi + 3.7 + + + + javax.servlet + javax.servlet-api + 3.0.1 + + + + junit + junit + 3.8.1 + test + + + org.apache.poi + poi + 4.1.2 + + + + + + nexus + http://172.31.15.236:8081/repository/maven-snapshots/ + + + + nexus + http://172.31.15.236:8081/repository/maven-releases/ + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.19 + + + + + diff --git a/src/main/java/raffbrains/myweb/controller/Calculator.java b/src/main/java/raffbrains/myweb/controller/Calculator.java new file mode 100644 index 0000000..06b96e9 --- /dev/null +++ b/src/main/java/raffbrains/myweb/controller/Calculator.java @@ -0,0 +1,17 @@ +package raffbrains.myweb.controller; +/* + * + */ +public class Calculator { + /* + * @param i + * @param j + * @return int + */ + public int add(int i, int j){ + return i+j; + } + public int multiply(int i, int j){ + return i*j; + } +} diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..f253d58 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Mpho Raff Created Web Application + diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html new file mode 100644 index 0000000..feb4a75 --- /dev/null +++ b/src/main/webapp/index.html @@ -0,0 +1,18 @@ + + + + Bootstrap Example + + + + + + + + +
+

Java Home App!!!!

+
+ + + diff --git a/src/test/java/raffbrains/myweb/controller/CalculatorTest.java b/src/test/java/raffbrains/myweb/controller/CalculatorTest.java new file mode 100644 index 0000000..a4f40c3 --- /dev/null +++ b/src/test/java/raffbrains/myweb/controller/CalculatorTest.java @@ -0,0 +1,57 @@ +package raffbrains.myweb.controller; + + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Properties; + +import junit.framework.Assert; +import junit.framework.TestCase; + +public class CalculatorTest extends TestCase { + Calculator cal = new Calculator(); + + public void testAdd() { + Properties prop = new Properties(); + + OutputStream output = null; + + try + { + + output = new FileOutputStream("../config.properties"); + + // set the properties value + prop.setProperty("database", "localhost"); + prop.setProperty("dbuser", "hari"); + prop.setProperty("dbpassword", "password"); + + // save properties to project root folder + prop.store(output, null); + + }catch( + IOException io) + { + io.printStackTrace(); + }finally + { + if (output != null) { + try { + output.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + } + } + + public void testMultiply() { + Assert.assertEquals(cal.multiply(10, 20), 200); + } + + public void testAddNew() { + Assert.assertEquals(cal.add(10, 20), 30); + } +}