Revision: 149
http://cse-ip.svn.sourceforge.net/cse-ip/?rev=149&view=rev
Author: idueppe
Date: 2009-04-22 08:24:50 +0000 (Wed, 22 Apr 2009)
Log Message:
-----------
removed test file
Removed Paths:
-------------
trunk/sandbox/cse-ip/sc-mapper-rest/src/test/java/de/campussource/cse/mapper/rest/RestfulTest.java
Deleted: trunk/sandbox/cse-ip/sc-mapper-rest/src/test/java/de/campussource/cse/mapper/rest/RestfulTest.java
===================================================================
--- trunk/sandbox/cse-ip/sc-mapper-rest/src/test/java/de/campussource/cse/mapper/rest/RestfulTest.java 2009-04-22 08:23:19 UTC (rev 148)
+++ trunk/sandbox/cse-ip/sc-mapper-rest/src/test/java/de/campussource/cse/mapper/rest/RestfulTest.java 2009-04-22 08:24:50 UTC (rev 149)
@@ -1,96 +0,0 @@
-package de.campussource.cse.mapper.rest;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-import javax.swing.JOptionPane;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.sun.jersey.api.container.httpserver.HttpServerFactory;
-import com.sun.net.httpserver.HttpServer;
-
-@Path("/unittest")
-public class RestfulTest {
-
- private static final String LOCALHOST = "http://localhost:8888/";
-
- private static HttpServer server;
-
- @GET
- @Produces("text/plain")
- public String testSystem() {
- return "Hello. This is a test";
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- System.out.println("Creating Server...");
-
- server = HttpServerFactory.create(LOCALHOST);
- server.start();
-
- JOptionPane.showMessageDialog(null, "JAX-RS Server is running!");
-
- System.out.println("HTTP Server started.");
- System.out.println("Running tests...");
-
- }
-
- private static String testResourceAtUrl(URL url) throws Exception {
- try {
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-
- connection.setRequestMethod("GET");
- connection.connect();
-
- InputStream is = connection.getInputStream();
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- StringBuilder buffer = new StringBuilder();
- String line = null;
- while ((line = reader.readLine()) != null) {
- buffer.append(line);
- }
- System.out.println("Read: " + buffer.toString());
-
- connection.disconnect();
-
- return buffer.toString();
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- throw new Exception("Could not establish connection to " + url.toExternalForm());
- }
-
- @Test
- public void testRest() throws Exception {
- String activationText = testResourceAtUrl(new URL(LOCALHOST + "/mapper"));
- assertNotNull(activationText);
- assertFalse(activationText.isEmpty());
- }
-
- @AfterClass
- public static void tearDown() throws IOException {
- if (server != null) {
- System.out.println("Stopping server...");
- server.stop(0);
- System.out.println("Server stopped");
- }
-
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|