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

Gittan Kaus #51

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
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
49 changes: 49 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gittkaus</groupId>
<artifactId>testimine</artifactId>
<version>1</version>
<packaging>jar</packaging>

<name>testimine</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/>
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<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>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>
33 changes: 33 additions & 0 deletions src/main/java/gittkaus/Rakendus.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
30 changes: 30 additions & 0 deletions src/test/java/gittkaus/EsimeneTest.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}
Binary file added target/classes/gittkaus/Rakendus.class
Binary file not shown.
5 changes: 5 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#Generated by Apache Maven
#Thu May 25 14:06:37 EEST 2017
version=1
groupId=gittkaus
artifactId=testimine
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gittkaus/Rakendus.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/gittkaus/public_html/t06veebirakendus2/src/main/java/gittkaus/Rakendus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gittkaus/EsimeneTest.class
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/gittkaus/public_html/t06veebirakendus2/src/test/java/gittkaus/Test.java
63 changes: 63 additions & 0 deletions target/surefire-reports/TEST-gittkaus.EsimeneTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="gittkaus.EsimeneTest" time="0.001" tests="3" 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/gittkaus/public_html/t06veebirakendus2"/>
<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/gittkaus/public_html/t06veebirakendus2"/>
<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/gittkaus"/>
<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="gittkaus"/>
<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="IDtest1" classname="gittkaus.EsimeneTest" time="0.001"/>
<testcase name="IDtest2" classname="gittkaus.EsimeneTest" time="0"/>
<testcase name="test" classname="gittkaus.EsimeneTest" time="0"/>
</testsuite>
4 changes: 4 additions & 0 deletions target/surefire-reports/gittkaus.EsimeneTest.txt
Original file line number Diff line number Diff line change
@@ -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
Binary file added target/test-classes/gittkaus/EsimeneTest.class
Binary file not shown.
Binary file added target/testimine-1.jar
Binary file not shown.
Binary file added target/testimine-1.jar.original
Binary file not shown.