test-support and temperature #2
@ -1,5 +1,11 @@
|
|||||||
# Springboot weather service
|
# Springboot weather service
|
||||||
|
|
||||||
|
#### GIT:
|
||||||
|
|
||||||
|
- Create a new branch
|
||||||
|
- `add`, `commit` and `push` the branch to Gitea
|
||||||
|
- Create a `pull request` at Gitea from your branch to 'develop'
|
||||||
|
|
||||||
|
|
||||||
#### The _URI_ to access the current weather data:
|
#### The _URI_ to access the current weather data:
|
||||||
https://group-4-75.pvt.dsv.su.se/weather-0.0.1-SNAPSHOT/weather
|
https://group-4-75.pvt.dsv.su.se/weather-0.0.1-SNAPSHOT/weather
|
||||||
|
7
pom.xml
7
pom.xml
@ -10,7 +10,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<groupId>com.smhi</groupId>
|
<groupId>com.smhi</groupId>
|
||||||
<artifactId>weather</artifactId>
|
<artifactId>weather</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.2-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>weather</name>
|
<name>weather</name>
|
||||||
<description>Collecting current weather data in Stockholm</description>
|
<description>Collecting current weather data in Stockholm</description>
|
||||||
@ -33,6 +33,11 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
|
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -53,10 +53,13 @@ public class OpenWeatherService {
|
|||||||
|
|
||||||
private OpenResponce buildResult(Root root) {
|
private OpenResponce buildResult(Root root) {
|
||||||
OpenResponce responce = new OpenResponce();
|
OpenResponce responce = new OpenResponce();
|
||||||
|
DataVO dvo = new DataVO();
|
||||||
for (TimeSeries ts : root.timeSeries) {
|
for (TimeSeries ts : root.timeSeries) {
|
||||||
for (Parameter p : ts.parameters) {
|
for (Parameter p : ts.parameters) {
|
||||||
|
if (p.getName().equalsIgnoreCase("t")) {
|
||||||
|
dvo.setTemp(p.getValues().get(0));
|
||||||
|
}
|
||||||
if (p.getName().equalsIgnoreCase("Wsymb2")) {
|
if (p.getName().equalsIgnoreCase("Wsymb2")) {
|
||||||
DataVO dvo = new DataVO();
|
|
||||||
dvo.setWsymb2(p.getValues().get(0).intValue());
|
dvo.setWsymb2(p.getValues().get(0).intValue());
|
||||||
responce.setDataVO(dvo);
|
responce.setDataVO(dvo);
|
||||||
return responce;
|
return responce;
|
||||||
|
@ -4,22 +4,32 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
public class DataVO implements Serializable {
|
public class DataVO implements Serializable {
|
||||||
|
|
||||||
int Wsymb2;
|
int wsymb2;
|
||||||
|
double temp;
|
||||||
|
|
||||||
public DataVO() {}
|
public DataVO() {}
|
||||||
|
|
||||||
public int getWsymb2() {
|
public int getWsymb2() {
|
||||||
return Wsymb2;
|
return wsymb2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWsymb2(int wsymb2) {
|
public void setWsymb2(int wsymb2) {
|
||||||
Wsymb2 = wsymb2;
|
this.wsymb2 = wsymb2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTemp() {
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemp(double temp) {
|
||||||
|
this.temp = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DataVO{" +
|
return "DataVO{" +
|
||||||
"Wsymb2=" + Wsymb2 +
|
"wsymb2=" + wsymb2 +
|
||||||
|
", temp=" + temp +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.smhi.weather;
|
package com.smhi.weather;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
class OpenWeatherServiceTest {
|
class OpenWeatherServiceTest {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user