Search in sources :

Example 6 with WebsocketSubscriptionProtocol

use of it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol in project SEPA by arces-wot.

the class ITWebSocketSubscriptionProtocol method SubscribeAndResults.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void SubscribeAndResults() throws SEPASecurityException, SEPAPropertiesException, SEPAProtocolException, IOException, InterruptedException {
    WebsocketSubscriptionProtocol client = new WebsocketSubscriptionProtocol(provider.getJsap().getSubscribeHost(), provider.getJsap().getSubscribePort(), provider.getJsap().getSubscribePath(), this, provider.getClientSecurityManager());
    client.subscribe(provider.buildSubscribeRequest("ALL"));
    synchronized (mutex) {
        while (ITWebSocketSubscriptionProtocol.spuid == null) mutex.wait();
    }
    synchronized (mutex) {
        while (!ITWebSocketSubscriptionProtocol.results) mutex.wait();
    }
    client.close();
}
Also used : WebsocketSubscriptionProtocol(it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Timeout(org.junit.jupiter.api.Timeout)

Example 7 with WebsocketSubscriptionProtocol

use of it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol in project SEPA by arces-wot.

the class ITWebSocketSubscriptionProtocol method WrongSubscribe.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void WrongSubscribe() throws SEPASecurityException, SEPAPropertiesException, SEPAProtocolException, IOException, InterruptedException {
    WebsocketSubscriptionProtocol client = new WebsocketSubscriptionProtocol(provider.getJsap().getSubscribeHost(), provider.getJsap().getSubscribePort(), provider.getJsap().getSubscribePath(), this, provider.getClientSecurityManager());
    client.subscribe(provider.buildSubscribeRequest("WRONG"));
    synchronized (mutex) {
        while (!ITWebSocketSubscriptionProtocol.error) mutex.wait();
    }
    client.close();
}
Also used : WebsocketSubscriptionProtocol(it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Timeout(org.junit.jupiter.api.Timeout)

Aggregations

WebsocketSubscriptionProtocol (it.unibo.arces.wot.sepa.api.protocols.websocket.WebsocketSubscriptionProtocol)7 RepeatedTest (org.junit.jupiter.api.RepeatedTest)4 Timeout (org.junit.jupiter.api.Timeout)4 SPARQL11SEProtocol (it.unibo.arces.wot.sepa.api.SPARQL11SEProtocol)2 SEPAProtocolException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException)2 ConfigurationProvider (it.unibo.arces.wot.sepa.ConfigurationProvider)1 Sync (it.unibo.arces.wot.sepa.Sync)1 SEPABindingsException (it.unibo.arces.wot.sepa.commons.exceptions.SEPABindingsException)1 SEPAPropertiesException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAPropertiesException)1 SEPASecurityException (it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException)1 SubscribeRequest (it.unibo.arces.wot.sepa.commons.request.SubscribeRequest)1 QueryResponse (it.unibo.arces.wot.sepa.commons.response.QueryResponse)1 Response (it.unibo.arces.wot.sepa.commons.response.Response)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1