diff --git a/README.md b/README.md index f2818fc..e13fa8f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ -# t09tervikveeb +# t06veebirakendus2 -Spring veebirakenduse näide, kus - * Osa tegevusi/arvutusi on koondatud klasside sisse - * Arvutuste tulemusi testitakse - * Võimalusel talletatakse tegevuste ajalugu andmebaasi - * Võimalusel luuakse eraldi HTML-leht, mille kaudu pöördutakse REST teenuste poole - +Springi veebirakendus koos andmebaasist otsingu või automaattestidega. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3b525a3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + gittkaus + testimine + 1 + jar + + testimine + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.2.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/src/main/java/gittkaus/Rakendus.java b/src/main/java/gittkaus/Rakendus.java new file mode 100644 index 0000000..afc6d46 --- /dev/null +++ b/src/main/java/gittkaus/Rakendus.java @@ -0,0 +1,33 @@ +package gittkaus; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +public class Rakendus { + + String Tervitus(String nimi){ + if (nimi == null) {return "Pole kedagi tervitada";} + if (nimi.equals("")){return "Sisend on tyhi";} + else { return "Tere, " + nimi + "!";} + } + + String IDNumber(String IDkood) { + if (IDkood == null) {return "ID puudub!";} + if (IDkood.equals("")) {return "ID on tyhi!";} + if (IDkood.length() == 11) {return "ID peab olema 11 tahemarki pikk!";} + return IDkood; + } + + String IDsugu(String IDkood){ + String kood = IDkood.substring(0,1); + if (kood.equals("3")||kood.equals("5")||kood.equals("1")){return "See on mehe ID";} + if (kood.equals("4")||kood.equals("6")||kood.equals("2")){return "See on naise ID";} + return IDkood; + } + + public static void main(String[] args) { + Rakendus rakendus = new Rakendus(); + } +} \ No newline at end of file diff --git a/src/test/java/gittkaus/EsimeneTest.java b/src/test/java/gittkaus/EsimeneTest.java new file mode 100644 index 0000000..a875f92 --- /dev/null +++ b/src/test/java/gittkaus/EsimeneTest.java @@ -0,0 +1,30 @@ +package gittkaus; + +import org.junit.*; + +import static org.junit.Assert.*; + +public class EsimeneTest { + + Rakendus rakendus = new Rakendus(); + + @Test + public void test(){ + assertEquals("Pole kedagi tervitada", rakendus.Tervitus(null)); + assertEquals("Sisend on tyhi", rakendus.Tervitus("")); + assertEquals("Tere, Gittan!", rakendus.Tervitus("Gittan")); + } + + @Test + public void IDtest1() { + assertEquals("ID puudub!", rakendus.IDNumber(null)); + assertEquals("ID on tyhi!", rakendus.IDNumber("")); + assertEquals("ID peab olema 11 tahemarki pikk!", rakendus.IDNumber("38905220293")); + } + + @Test + public void IDtest2(){ + assertEquals("See on mehe ID", rakendus.IDsugu("38905220293")); + assertEquals("See on naise ID", rakendus.IDsugu("49409262769")); + } +} \ No newline at end of file diff --git a/target/classes/gittkaus/Rakendus.class b/target/classes/gittkaus/Rakendus.class new file mode 100644 index 0000000..ad45343 Binary files /dev/null and b/target/classes/gittkaus/Rakendus.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..f11b10d --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Apache Maven +#Thu May 25 14:06:37 EEST 2017 +version=1 +groupId=gittkaus +artifactId=testimine diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..dd6301e --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1 @@ +gittkaus/Rakendus.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..ed92e76 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1 @@ +/home/gittkaus/public_html/t06veebirakendus2/src/main/java/gittkaus/Rakendus.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..6023222 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +gittkaus/EsimeneTest.class diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..647e58a --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/gittkaus/public_html/t06veebirakendus2/src/test/java/gittkaus/Test.java diff --git a/target/surefire-reports/TEST-gittkaus.EsimeneTest.xml b/target/surefire-reports/TEST-gittkaus.EsimeneTest.xml new file mode 100644 index 0000000..73e3f0c --- /dev/null +++ b/target/surefire-reports/TEST-gittkaus.EsimeneTest.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/target/surefire-reports/gittkaus.EsimeneTest.txt b/target/surefire-reports/gittkaus.EsimeneTest.txt new file mode 100644 index 0000000..00b2ad6 --- /dev/null +++ b/target/surefire-reports/gittkaus.EsimeneTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: gittkaus.EsimeneTest +------------------------------------------------------------------------------- +Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in gittkaus.EsimeneTest diff --git a/target/test-classes/gittkaus/EsimeneTest.class b/target/test-classes/gittkaus/EsimeneTest.class new file mode 100644 index 0000000..92e93bf Binary files /dev/null and b/target/test-classes/gittkaus/EsimeneTest.class differ diff --git a/target/testimine-1.jar b/target/testimine-1.jar new file mode 100644 index 0000000..e69627c Binary files /dev/null and b/target/testimine-1.jar differ diff --git a/target/testimine-1.jar.original b/target/testimine-1.jar.original new file mode 100644 index 0000000..e42effc Binary files /dev/null and b/target/testimine-1.jar.original differ