STest.java [test/service_tests] Revision: default Date:
package service_tests;
import csip.test.ServiceTest2;
import java.io.File;
import java.util.Properties;
import org.codehaus.jettison.json.JSONArray;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
/**
*
* @author od
*/
public class STest {
@Rule
public TestName name = new TestName();
private void run() throws Exception {
String testFolder = new File(getClass().getCanonicalName().replace('.', '/')).getParent();
JSONArray r = ServiceTest2.run(new Properties(), "test/" + testFolder + "/" + name.getMethodName() + ".json");
Assert.assertTrue(r.getJSONObject(0).getInt("successful") == 1);
}
/*
1. Run a service against an endpoint.
2. If successful, store the response in 'tests/service_tests'
3. Name it : <servicepath>__<name>.json
Example:
The service response is 'alfafa.json' and ran
successfully against
http://csip.engr.colostate.edu/csip-erosion/m/weps/1.3
store this response as
tests/service_tests/m_weps_1_3__alfalfa.json
- replace '/' with '_'
- replace '.' with '_'
- separate both parts with '__'
4. Add a new JUnit test for this service to this file:
@Test public void m_weps_1_3__alfalfa() throws Exception {
run();
}
The test method name and the name of the json file
(without the extension) must match!
This is it!
*/
//@Test public void m_gras_getforadjcat_1_0() throws Exception { run(); }
// .. more here
@Test public void svap01a_getusfsecoreg_1_0__test1() throws Exception { run();}
@Test public void svap01b_getepaecoreg_1_0__test1() throws Exception { run();}
@Test public void svap01c_getmlra_1_0__test1() throws Exception { run();}
@Test public void svap02_svapnhddata_1_0__test1() throws Exception { run();}
@Test public void svap03_svaplanduse_1_0__test1() throws Exception { run();}
@Test public void svap04_svapstreammiles_1_0__test1() throws Exception { run();}
@Test public void svap05a_svaphydroa_1_0__test1() throws Exception { run();}
@Test public void svap05b_svaphydrob_1_0__test1() throws Exception { run();}
@Test public void svap06_svapstreamflow_1_0__test1() throws Exception { run();}
@Test public void svap11_svapscore_1_0__test1() throws Exception { run();}
@Test public void svap11_svapscore_1_0__test2() throws Exception { run();}
@Test public void svap11_svapscore_1_0__test3() throws Exception { run();}
@Test public void svap11_svapscore_1_0__test4() throws Exception { run();}
@Test public void svap11_svapscore_1_0__test5() throws Exception { run();}
}