STest.java [test/service_tests] Revision: default Date:
package service_tests;
import csip.utils.Client;
import java.io.File;
import org.codehaus.jettison.json.JSONObject;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
/**
*
* @author od
*/
public class STest {
static String url = "http://localhost:8080/csip-rivertrak/m/rivertrak/1.0";
@Rule
public TestName name = new TestName();
@Test
public void example() throws Exception {
File f = new File("data", "ex_data.zip");
Assert.assertTrue(f.exists());
Assert.assertTrue("Check availability", Client.ping(url, 1000) > 0);
Client c = new Client(null);
JSONObject req = new JSONObject(c.doGET(url));
System.out.println(req.toString(2));
JSONObject response = c.doPOST(url, req, new File[]{f});
Assert.assertEquals("Status", "Finished",
response.getJSONObject("metainfo").getString("status"));
}
}