Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • VIPS/VIPSLogic
1 result
Select Git revision
Show changes
Showing
with 182 additions and 136 deletions
......@@ -2,18 +2,18 @@
Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
This file is part of VIPSLogic.
VIPSLogic is free software: you can redistribute it and/or modify
it under the terms of the NIBIO Open Source License as published by
NIBIO, either version 1 of the License, or (at your option) any
later version.
VIPSLogic is distributed in the hope that it will be useful,
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
NIBIO Open Source License for more details.
You should have received a copy of the NIBIO Open Source License
along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
--><#include "master.ftl">
<#macro page_head>
<title>${i18nBundle.weatherStations}</title>
......
......@@ -2,18 +2,18 @@
Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
This file is part of VIPSLogic.
VIPSLogic is free software: you can redistribute it and/or modify
it under the terms of the NIBIO Open Source License as published by
NIBIO, either version 1 of the License, or (at your option) any
later version.
VIPSLogic is distributed in the hope that it will be useful,
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
NIBIO Open Source License for more details.
You should have received a copy of the NIBIO Open Source License
along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
--><#include "master.ftl">
<#macro page_head>
<title>${weatherStation.name}</title>
......
......@@ -4,19 +4,18 @@
* #
# Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
#
# This file is part of VIPSLogic.
# VIPSLogic is free software: you can redistribute it and/or modify
# it under the terms of the NIBIO Open Source License as published by
# NIBIO, either version 1 of the License, or (at your option) any
# later version.
#
# VIPSLogic is distributed in the hope that it will be useful,
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# NIBIO Open Source License for more details.
#
# You should have received a copy of the NIBIO Open Source License
# along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
*
*/
......
......@@ -19,11 +19,11 @@ package no.nibio.vips.logic.entity.rest;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import jakarta.ws.rs.client.Client;
import jakarta.ws.rs.client.ClientBuilder;
import jakarta.ws.rs.client.Entity;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.MediaType;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
......
/*
* Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
* Copyright (c) 2014 NIBIO <http://www.nibio.no/>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
* Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*
*/
package no.nibio.vips.logic.forms;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import no.nibio.web.forms.HTMLFormGenerator;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import no.nibio.web.forms.HTMLFormGenerator;
/**
*
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class HTMLFormGeneratorTest {
public HTMLFormGeneratorTest() {
}
public HTMLFormGeneratorTest() {}
@BeforeClass
public static void setUpClass() {
}
public static void setUpClass() {}
@AfterClass
public static void tearDownClass() {
}
public static void tearDownClass() {}
@Before
public void setUp() {
}
public void setUp() {}
@After
public void tearDown() {
}
public void tearDown() {}
@Test
public void testGetHTMLForm() {
try {
String language="no";
String language = "no";
HTMLFormGenerator t = new HTMLFormGenerator();
assertNotNull(t);
InputStream in = this.getClass().getResourceAsStream("/HTMLFormGeneratorTest/forecastConfigurationForm.json");
InputStreamReader reader = new InputStreamReader(in,"UTF-8");
InputStream in =
this.getClass().getResourceAsStream("/HTMLFormGeneratorTest/forecastConfigurationForm.json");
InputStreamReader reader = new InputStreamReader(in, "UTF-8");
ObjectMapper mapper = new ObjectMapper();
JsonFactory factory = mapper.getFactory();
JsonParser parser = factory.createParser(reader);
JsonNode formDefinition = mapper.readTree(parser);
InputStream in2 = this.getClass().getResourceAsStream("/HTMLFormGeneratorTest/forecastConfigurationForm_result.html");
InputStream in2 =
this.getClass().getResourceAsStream("/HTMLFormGeneratorTest/forecastConfigurationForm_result.html");
InputStreamReader reader2 = new InputStreamReader(in2, "UTF-8");
java.util.Scanner s = new java.util.Scanner(reader2).useDelimiter("\\A");
String result = s.hasNext() ? s.next() : "";
//System.out.println("expectedResult=\n" + result);
String HTMLForm = t.getHTMLFormFields(formDefinition,"forecastConfigurationForm",language);
//System.out.println("HTMLForm=\n" + HTMLForm);
assertEquals(result,HTMLForm);
// System.out.println("expectedResult=\n" + result);
String HTMLForm = t.getHTMLFormFields(formDefinition, "forecastConfigurationForm", language);
System.out.println("HTMLForm=\n" + HTMLForm);
assertEquals(HTMLForm, result);
} catch (IOException ex) {
fail(ex.getMessage());
}
......
......@@ -22,7 +22,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
import jakarta.ws.rs.core.Response;
import no.nibio.vips.logic.util.RESTAuthenticator;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
......
{
"_comment" : "Structure of the forecastConfigurationForm and how to validate it",
"_comment": "Structure of the forecastConfigurationForm and how to validate it",
"fields": [
{
"name" : "forecastConfigurationId",
"fieldType" : "HIDDEN",
"dataType" : "INTEGER",
"webValue" : ["7"],
"required" : true
"name": "forecastConfigurationId",
"fieldType": "HIDDEN",
"dataType": "INTEGER",
"webValue": [
"7"
],
"required": true
},
{
"name" : "vipsLogicUserId",
"dataType" : "INTEGER",
"fieldType" : "SELECT_SINGLE",
"name": "vipsLogicUserId",
"dataType": "INTEGER",
"fieldType": "SELECT_SINGLE",
"nullValue": "-1",
"required" : true,
"options":[
{"value":"-1","label":"Vennligst velg bruker","selected":false},
{"value":"1","label":"Skog, Tor-Einar","selected":true}
]
"required": true,
"options": [
{
"value": "-1",
"label": "Vennligst velg bruker",
"selected": false
},
{
"value": "1",
"label": "Skog, Tor-Einar",
"selected": true
}
]
},
{
"name" : "modelId",
"fieldType" : "SELECT_SINGLE",
"dataType" : "INTEGER",
"name": "modelId",
"fieldType": "SELECT_SINGLE",
"dataType": "INTEGER",
"nullValue": "-1",
"required" : true,
"options":[
{"value":"-1","label":"Vennligst velg varslingsmodell","selected":false},
{"value":"NAERSTADMO","label":"Nærstads modell","selected":true},
{"value":"APPLESCABM","label":"Epleskurvmodell","selected":false}
]
"required": true,
"options": [
{
"value": "-1",
"label": "Vennligst velg varslingsmodell",
"selected": false
},
{
"value": "NAERSTADMO",
"label": "Nærstads modell",
"selected": true
},
{
"value": "APPLESCABM",
"label": "Epleskurvmodell",
"selected": false
}
]
},
{
"name" : "locationPointOfInterestId",
"dataType" : "INTEGER",
"fieldType" : "SELECT_SINGLE",
"name": "locationPointOfInterestId",
"dataType": "INTEGER",
"fieldType": "SELECT_SINGLE",
"nullValue": "-1",
"required" : true,
"options":[
{"value":"-1","label":"Vennligst velg målestasjon","selected":false},
{"value":"38","label":"Ullensvang","selected":false},
{"value":"72","label":"Ås","selected":true}
]
"required": true,
"options": [
{
"value": "-1",
"label": "Vennligst velg værstasjon",
"selected": false
},
{
"value": "38",
"label": "Ullensvang",
"selected": false
},
{
"value": "72",
"label": "Ås",
"selected": true
}
]
},
{
"name" : "weatherStationPointOfInterestId",
"dataType" : "INTEGER",
"fieldType" : "SELECT_SINGLE",
"name": "weatherStationPointOfInterestId",
"dataType": "INTEGER",
"fieldType": "SELECT_SINGLE",
"nullValue": "-1",
"required" : true,
"options":[
{"value":"-1","label":"Vennligst velg lokalitet","selected":false},
{"value":"38","label":"Ullensvang","selected":false},
{"value":"72","label":"Ås","selected":true}
]
"required": true,
"options": [
{
"value": "-1",
"label": "Vennligst velg lokalitet",
"selected": false
},
{
"value": "38",
"label": "Ullensvang",
"selected": false
},
{
"value": "72",
"label": "Ås",
"selected": true
}
]
},
{
"name" : "dateStart",
"dataType" : "DATE",
"required" : true
"name": "dateStart",
"dataType": "DATE",
"required": true
},
{
"name" : "dateEnd",
"dataType" : "DATE",
"required" : true
"name": "dateEnd",
"dataType": "DATE",
"required": true
}
],
"relations":[
{"primaryField":"dateEnd","secondaryField":"dateStart", "relationType": "AFTER"}
"relations": [
{
"primaryField": "dateEnd",
"secondaryField": "dateStart",
"relationType": "AFTER"
}
]
}
}
\ No newline at end of file
......@@ -26,7 +26,7 @@
<span class="help-block" id="forecastConfigurationForm_locationPointOfInterestId_validation"></span>
</div>
<div class="form-group">
<label for="weatherStationPointOfInterestId">Målestasjon</label>
<label for="weatherStationPointOfInterestId">Værstasjon</label>
<select class="form-control" name="weatherStationPointOfInterestId" onblur="validateField(this);">
<option value="-1">Vennligst velg lokalitet</option>
<option value="38">Ullensvang</option>
......
......@@ -130,9 +130,9 @@
<span class="help-block" id="forecastConfigurationForm_locationPointOfInterestId_validation"></span>
</div>
<div class="form-group">
<label for="weatherStationPointOfInterestId">Målestasjon</label>
<label for="weatherStationPointOfInterestId">Værstasjon</label>
<select class="form-control" name="weatherStationPointOfInterestId" onblur="validateField(this);">
<option value="-1">Vennligst velg målestasjon</option>
<option value="-1">Vennligst velg værstasjon</option>
<option value="54">Alvdal</option>
<option value="91" selected="selected">Apelsvoll</option>
<option value="30">Balestrand</option>
......
......@@ -17,16 +17,16 @@
<span class="help-block" id="forecastConfigurationForm_modelId_validation"></span>
</div>
<div class="form-group">
<label for="locationPointOfInterestId">Lokalitet</label>
<label for="locationPointOfInterestId">Sted</label>
<select class="form-control" name="locationPointOfInterestId" onblur="validateField(this);">
<option value="-1">Vennligst velg målestasjon</option>
<option value="-1">Vennligst velg værstasjon</option>
<option value="38">Ullensvang</option>
<option value="72" selected="selected">Ås</option>
</select>
<span class="help-block" id="forecastConfigurationForm_locationPointOfInterestId_validation"></span>
</div>
<div class="form-group">
<label for="weatherStationPointOfInterestId">Målestasjon</label>
<label for="weatherStationPointOfInterestId">Værstasjon</label>
<select class="form-control" name="weatherStationPointOfInterestId" onblur="validateField(this);">
<option value="-1">Vennligst velg lokalitet</option>
<option value="38">Ullensvang</option>
......
......@@ -130,9 +130,9 @@
<span class="help-block" id="forecastConfigurationForm_locationPointOfInterestId_validation"></span>
</div>
<div class="form-group">
<label for="weatherStationPointOfInterestId">Målestasjon</label>
<label for="weatherStationPointOfInterestId">Værstasjon</label>
<select class="form-control" name="weatherStationPointOfInterestId" onblur="validateField(this);">
<option value="-1">Vennligst velg målestasjon</option>
<option value="-1">Vennligst velg værstasjon</option>
<option value="54">Alvdal</option>
<option value="91" selected="selected">Apelsvoll</option>
<option value="30">Balestrand</option>
......