org.simpleframework.http.core.ContainerServer Java Examples

The following examples show how to use org.simpleframework.http.core.ContainerServer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TriplestoreStorageTest.java    From IGUANA with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * @throws IOException
 */
@Test
public void metaTest() throws IOException{
	fastServerContainer = new ServerMock();
       fastServer = new ContainerServer(fastServerContainer);
       fastConnection = new SocketConnection(fastServer);
       SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
       fastConnection.connect(address1);
       
       String host = "http://localhost:8023";
       TriplestoreStorage store = new TriplestoreStorage(host, host);
       Properties p = new Properties();
	p.put(COMMON.EXPERIMENT_TASK_ID_KEY, "1/1/1");
    p.setProperty(COMMON.EXPERIMENT_ID_KEY, "1/1");
    p.setProperty(COMMON.CONNECTION_ID_KEY, "virtuoso");
    p.setProperty(COMMON.SUITE_ID_KEY, "1");
    p.setProperty(COMMON.DATASET_ID_KEY, "dbpedia");
    p.put(COMMON.RECEIVE_DATA_START_KEY, "true");
    p.put(COMMON.EXTRA_META_KEY, new Properties());
    p.put(COMMON.NO_OF_QUERIES, 2);
       store.addMetaData(p);
       
       assertEquals(metaExp.trim(), fastServerContainer.getActualContent().trim());
}
 
Example #2
Source File: TriplestoreStorageTest.java    From IGUANA with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * @throws IOException
 */
@Test
public void dataTest() throws IOException{
	fastServerContainer = new ServerMock();
       fastServer = new ContainerServer(fastServerContainer);
       fastConnection = new SocketConnection(fastServer);
       SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
       fastConnection.connect(address1);
       
       String host = "http://localhost:8023";
       TriplestoreStorage store = new TriplestoreStorage(host, host);
       Properties p = new Properties();
       p.setProperty(COMMON.EXPERIMENT_TASK_ID_KEY, "1/1/1");
    p.put(COMMON.METRICS_PROPERTIES_KEY, "testMetric");
    p.put(COMMON.EXTRA_META_KEY, new Properties());
       
       Triple[] t = new Triple[1];
    t[0] = new Triple("a", "b", "c");
    store.addData(p, t);
    store.commit();
       assertEquals(dataExp.trim(),fastServerContainer.getActualContent().trim());
}
 
Example #3
Source File: HttpWorkerTest.java    From office-365-connector-plugin with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws IOException {
    Container container = new MyHandler();
    Server server = new ContainerServer(container);
    connection = new SocketConnection(server);
    SocketAddress address = new InetSocketAddress(8000);
    connection.connect(address);
}
 
Example #4
Source File: HttpBasedAnnotatorTest.java    From gerbil with GNU Affero General Public License v3.0 5 votes vote down vote up
@Before
public void startServer() throws IOException {
    fastServerContainer = new WaitingDocumentReturningServerMock(DOCUMENTS, 0);
    fastServer = new ContainerServer(fastServerContainer);
    fastConnection = new SocketConnection(fastServer);
    SocketAddress address1 = new InetSocketAddress(FAST_SERVER_PORT);
    fastConnection.connect(address1);
    slowServer = new ContainerServer(new WaitingDocumentReturningServerMock(DOCUMENTS, SLOW_SERVER_WAITING_TIME));
    slowConnection = new SocketConnection(slowServer);
    SocketAddress address2 = new InetSocketAddress(SLOW_SERVER_PORT);
    slowConnection.connect(address2);
}
 
Example #5
Source File: ValidatingHttpServer.java    From jersey-hmac-auth with Apache License 2.0 5 votes vote down vote up
public Connection connect() throws Exception {
    Server server = new ContainerServer(this);
    Connection connection = new SocketConnection(server);
    SocketAddress address = new InetSocketAddress(port);
    connection.connect(address);
    return connection;
}
 
Example #6
Source File: UPDATEWorkerTest.java    From IGUANA with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @throws IOException
 */
public UPDATEWorkerTest() throws IOException {
	ServerMock mock = new ServerMock();
	ContainerServer fastServer = new ContainerServer(mock);
	fastConnection = new SocketConnection(fastServer);
	address1 = new InetSocketAddress(8023);
}
 
Example #7
Source File: ServerFixture.java    From fixd with Apache License 2.0 5 votes vote down vote up
public void start() throws IOException {
    
    server = new FixdServer(new ContainerServer(container));
    connection = new SocketConnection(server, new LoggingAgent());
    SocketAddress address = new InetSocketAddress(port);
    
    actualConnectionAddress = (InetSocketAddress)connection.connect(address);
}