Search in sources :

Example 1 with ConfigurationProvider

use of it.unibo.arces.wot.sepa.ConfigurationProvider in project SEPA by arces-wot.

the class ITSPARQL11SEProtocol method beginTest.

@BeforeEach
public void beginTest() throws IOException, SEPAProtocolException, SEPAPropertiesException, SEPASecurityException, URISyntaxException, InterruptedException {
    provider = new ConfigurationProvider();
    handler = new Sync();
    protocol = new WebsocketSubscriptionProtocol(provider.getJsap().getSubscribeHost(), provider.getJsap().getSubscribePort(), provider.getJsap().getSubscribePath(), handler, provider.getClientSecurityManager());
    client = new SPARQL11SEProtocol(protocol, provider.getClientSecurityManager());
    Response ret = client.update(provider.buildUpdateRequest("DELETE_ALL"));
    assertFalse(ret.isError(), String.valueOf(ret));
}
Also used : Response(it.unibo.arces.wot.sepa.commons.response.Response) QueryResponse(it.unibo.arces.wot.sepa.commons.response.QueryResponse) ConfigurationProvider(it.unibo.arces.wot.sepa.ConfigurationProvider) WebsocketSubscriptionProtocol(it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol) Sync(it.unibo.arces.wot.sepa.Sync) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with ConfigurationProvider

use of it.unibo.arces.wot.sepa.ConfigurationProvider in project SEPA by arces-wot.

the class ITWebsocketClientEndpoint method init.

@BeforeAll
public static void init() throws SEPAPropertiesException, SEPASecurityException, InterruptedException, SEPAProtocolException {
    provider = new ConfigurationProvider();
    // Connect
    String scheme = "ws://";
    if (provider.getClientSecurityManager() != null)
        scheme = "wss://";
    if (provider.getJsap().getSubscribePort() == -1)
        try {
            url = new URI(scheme + provider.getJsap().getSubscribeHost() + provider.getJsap().getSubscribePath());
        } catch (URISyntaxException e) {
            logger.error(e.getMessage());
            throw new SEPAProtocolException(e);
        }
    else
        try {
            url = new URI(scheme + provider.getJsap().getSubscribeHost() + ":" + provider.getJsap().getSubscribePort() + provider.getJsap().getSubscribePath());
        } catch (URISyntaxException e) {
            logger.error(e.getMessage());
            throw new SEPAProtocolException(e);
        }
}
Also used : SEPAProtocolException(it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException) ConfigurationProvider(it.unibo.arces.wot.sepa.ConfigurationProvider) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 3 with ConfigurationProvider

use of it.unibo.arces.wot.sepa.ConfigurationProvider in project SEPA by arces-wot.

the class StressUsingSPARQLProtocol method beginTest.

@BeforeEach
public void beginTest() throws IOException, SEPAProtocolException, SEPAPropertiesException, SEPASecurityException, URISyntaxException, InterruptedException {
    provider = new ConfigurationProvider();
    sync = new Sync();
    client = new SPARQL11Protocol(provider.getClientSecurityManager());
    Response ret = client.update(provider.buildUpdateRequest("DELETE_ALL"));
    logger.debug(ret);
    assertFalse(ret.isError(), String.valueOf(ret));
    subscribers.clear();
    publishers.clear();
    sync.reset();
}
Also used : Response(it.unibo.arces.wot.sepa.commons.response.Response) ConfigurationProvider(it.unibo.arces.wot.sepa.ConfigurationProvider) SPARQL11Protocol(it.unibo.arces.wot.sepa.commons.protocol.SPARQL11Protocol) Sync(it.unibo.arces.wot.sepa.Sync) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ConfigurationProvider (it.unibo.arces.wot.sepa.ConfigurationProvider)3 Sync (it.unibo.arces.wot.sepa.Sync)2 Response (it.unibo.arces.wot.sepa.commons.response.Response)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 WebsocketSubscriptionProtocol (it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol)1 SEPAProtocolException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException)1 SPARQL11Protocol (it.unibo.arces.wot.sepa.commons.protocol.SPARQL11Protocol)1 QueryResponse (it.unibo.arces.wot.sepa.commons.response.QueryResponse)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1