Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mart Ambur #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions t09tervikveeb/README.md
Original file line number Diff line number Diff line change
@@ -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

33 changes: 33 additions & 0 deletions t09tervikveeb/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>amburma</groupId>
<artifactId>boot1</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.6.RELEASE</version>
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
17 changes: 17 additions & 0 deletions t09tervikveeb/src/main/java/mart/Inimene.java
Original file line number Diff line number Diff line change
@@ -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;
}

}
43 changes: 43 additions & 0 deletions t09tervikveeb/src/main/java/mart/Wingload.java
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions t09tervikveeb/src/test/java/mart/EsimeneTest.java
Original file line number Diff line number Diff line change
@@ -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);
}
}
Binary file added t09tervikveeb/target/boot1-1.0-SNAPSHOT.jar
Binary file not shown.
Binary file not shown.
Binary file added t09tervikveeb/target/classes/mart/Inimene.class
Binary file not shown.
Binary file added t09tervikveeb/target/classes/mart/Wingload.class
Binary file not shown.
5 changes: 5 additions & 0 deletions t09tervikveeb/target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Maven
#Tue Jun 20 17:22:09 EEST 2017
version=1.0-SNAPSHOT
groupId=amburma
artifactId=boot1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mart/Inimene.class
mart/Wingload.class
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mart/EsimeneTest.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/amburma/public_html/prpohi/martambur/t09tervikveeb/src/test/java/mart/EsimeneTest.java
62 changes: 62 additions & 0 deletions t09tervikveeb/target/surefire-reports/TEST-mart.EsimeneTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="mart.EsimeneTest" time="0.001" tests="2" errors="0" skipped="0" failures="0">
<properties>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/amd64"/>
<property name="java.vm.version" value="25.121-b13"/>
<property name="java.vm.vendor" value="Oracle Corporation"/>
<property name="maven.multiModuleProjectDirectory" value="/home/amburma/public_html/prpohi/martambur/t09tervikveeb"/>
<property name="java.vendor.url" value="http://java.oracle.com/"/>
<property name="path.separator" value=":"/>
<property name="guice.disable.misplaced.annotation.check" value="true"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="file.encoding.pkg" value="sun.io"/>
<property name="user.country" value="US"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="user.dir" value="/home/amburma/public_html/prpohi/martambur/t09tervikveeb"/>
<property name="java.runtime.version" value="1.8.0_121-b13"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="java.endorsed.dirs" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/endorsed"/>
<property name="os.arch" value="amd64"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="line.separator" value="&#10;"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="os.name" value="Linux"/>
<property name="classworlds.conf" value="/opt/rh/rh-maven33/root/usr/share/maven/bin/m2.conf"/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.library.path" value="/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.class.version" value="52.0"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="os.version" value="2.6.32-642.11.1.el6.x86_64"/>
<property name="user.home" value="/home/amburma"/>
<property name="user.timezone" value="Europe/Tallinn"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.specification.version" value="1.8"/>
<property name="user.name" value="amburma"/>
<property name="java.class.path" value="/opt/rh/rh-maven33/root/usr/share/maven/boot/plexus-classworlds.jar"/>
<property name="java.vm.specification.version" value="1.8"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.home" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre"/>
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher package"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="user.language" value="en"/>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="java.vm.info" value="mixed mode"/>
<property name="java.version" value="1.8.0_121"/>
<property name="java.ext.dirs" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/ext:/usr/java/packages/lib/ext"/>
<property name="sun.boot.class.path" value="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/rt.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/lib/jfr.jar:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre/classes"/>
<property name="java.vendor" value="Oracle Corporation"/>
<property name="maven.home" value="/opt/rh/rh-maven33/root/usr/share/maven"/>
<property name="file.separator" value="/"/>
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
<property name="sun.cpu.endian" value="little"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="sun.cpu.isalist" value=""/>
</properties>
<testcase name="test1" classname="mart.EsimeneTest" time="0.001"/>
<testcase name="test2" classname="mart.EsimeneTest" time="0"/>
</testsuite>
4 changes: 4 additions & 0 deletions t09tervikveeb/target/surefire-reports/mart.EsimeneTest.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.