diff --git a/t09tervikveeb/README.md b/t09tervikveeb/README.md new file mode 100644 index 0000000..f2818fc --- /dev/null +++ b/t09tervikveeb/README.md @@ -0,0 +1,8 @@ +# t09tervikveeb + +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 + diff --git a/t09tervikveeb/pom.xml b/t09tervikveeb/pom.xml new file mode 100644 index 0000000..25de214 --- /dev/null +++ b/t09tervikveeb/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + amburma + boot1 + jar + 1.0-SNAPSHOT + + org.springframework.boot + spring-boot-starter-parent + 1.3.6.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/t09tervikveeb/src/main/java/mart/Inimene.java b/t09tervikveeb/src/main/java/mart/Inimene.java new file mode 100644 index 0000000..c51a868 --- /dev/null +++ b/t09tervikveeb/src/main/java/mart/Inimene.java @@ -0,0 +1,17 @@ +package mart; +public class Inimene{ + public double lbsid; + public double ruutjalad; + + + public Inimene(double lbsid, double ruutjalad){ + this.lbsid = lbsid; + this.ruutjalad = ruutjalad; + } + public double lbs(){ + lbsid = lbsid*2.2; + + return lbsid; + } + +} \ No newline at end of file diff --git a/t09tervikveeb/src/main/java/mart/Wingload.java b/t09tervikveeb/src/main/java/mart/Wingload.java new file mode 100644 index 0000000..686fca3 --- /dev/null +++ b/t09tervikveeb/src/main/java/mart/Wingload.java @@ -0,0 +1,43 @@ +package mart; + +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; +@RestController +@SpringBootApplication +public class Wingload { + + @RequestMapping("/inimene3Wl") + String tervitusfunktsioon() { + + Inimene inimene3=new Inimene(65.0, 140.0); + return "Wingload1 on: "+inimene3.lbs()/inimene3.ruutjalad; + } + + @RequestMapping("/inimene2Lbs") + String tervitusfunktsioon2() { + + Inimene inimene2=new Inimene(60.0, 135.0); + return "Kui lbs oleks kg siis mu kaal oleks nii suur: "+inimene2.lbs(); + } + + @RequestMapping("/inimene1Wl") + String tervitusfunktsioon3() { + + Inimene inimene1=new Inimene(70.0, 150.0); + return "Wingload1 on: "+inimene1.lbs()/inimene1.ruutjalad; + + } + public static void main(String[] args) { + System.getProperties().put("server.port", 1234); + SpringApplication.run(Wingload.class, args); + + + + } +} + +//scl enable rh-maven33 bash +//mvn package +//java -jar target/boot1-1.0-SNAPSHOT.jar \ No newline at end of file diff --git a/t09tervikveeb/src/test/java/mart/EsimeneTest.java b/t09tervikveeb/src/test/java/mart/EsimeneTest.java new file mode 100644 index 0000000..99038d9 --- /dev/null +++ b/t09tervikveeb/src/test/java/mart/EsimeneTest.java @@ -0,0 +1,19 @@ +package mart; + +import org.junit.*; +import static org.junit.Assert.*; + + +public class EsimeneTest{ + @Test + public void test1(){ + assertEquals("Esimene","Esimene"); + } + @Test + public void test2(){ + final double DELTA = 1e-15; + Inimene testin1 = new Inimene(70, 150); + float expectedResult=154.0f; + assertEquals(expectedResult, testin1.lbs(),DELTA); + } +} \ No newline at end of file diff --git a/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar b/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar new file mode 100644 index 0000000..b92b6ab Binary files /dev/null and b/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar differ diff --git a/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar.original b/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar.original new file mode 100644 index 0000000..a4cd444 Binary files /dev/null and b/t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar.original differ diff --git a/t09tervikveeb/target/classes/mart/Inimene.class b/t09tervikveeb/target/classes/mart/Inimene.class new file mode 100644 index 0000000..1d78025 Binary files /dev/null and b/t09tervikveeb/target/classes/mart/Inimene.class differ diff --git a/t09tervikveeb/target/classes/mart/Wingload.class b/t09tervikveeb/target/classes/mart/Wingload.class new file mode 100644 index 0000000..22892ce Binary files /dev/null and b/t09tervikveeb/target/classes/mart/Wingload.class differ diff --git a/t09tervikveeb/target/maven-archiver/pom.properties b/t09tervikveeb/target/maven-archiver/pom.properties new file mode 100644 index 0000000..903fa7a --- /dev/null +++ b/t09tervikveeb/target/maven-archiver/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jun 20 17:22:09 EEST 2017 +version=1.0-SNAPSHOT +groupId=amburma +artifactId=boot1 diff --git a/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..adae1ec --- /dev/null +++ b/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +mart/Inimene.class +mart/Wingload.class diff --git a/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..6416205 --- /dev/null +++ b/t09tervikveeb/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +/home/amburma/public_html/prpohi/martambur/t09tervikveeb/src/main/java/mart/Inimene.java +/home/amburma/public_html/prpohi/martambur/t09tervikveeb/src/main/java/mart/Wingload.java diff --git a/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000..399b31c --- /dev/null +++ b/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst @@ -0,0 +1 @@ +mart/EsimeneTest.class diff --git a/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..ea7b184 --- /dev/null +++ b/t09tervikveeb/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/amburma/public_html/prpohi/martambur/t09tervikveeb/src/test/java/mart/EsimeneTest.java diff --git a/t09tervikveeb/target/surefire-reports/TEST-mart.EsimeneTest.xml b/t09tervikveeb/target/surefire-reports/TEST-mart.EsimeneTest.xml new file mode 100644 index 0000000..8030880 --- /dev/null +++ b/t09tervikveeb/target/surefire-reports/TEST-mart.EsimeneTest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/t09tervikveeb/target/surefire-reports/mart.EsimeneTest.txt b/t09tervikveeb/target/surefire-reports/mart.EsimeneTest.txt new file mode 100644 index 0000000..8ee360c --- /dev/null +++ b/t09tervikveeb/target/surefire-reports/mart.EsimeneTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: mart.EsimeneTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in mart.EsimeneTest diff --git a/t09tervikveeb/target/test-classes/mart/EsimeneTest.class b/t09tervikveeb/target/test-classes/mart/EsimeneTest.class new file mode 100644 index 0000000..4122949 Binary files /dev/null and b/t09tervikveeb/target/test-classes/mart/EsimeneTest.class differ