Search in sources :

Example 1 with Publisher

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

the class StressUsingSPARQLProtocol method NotifyNx2NWithMalformedUpdates.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
public // @Timeout(5)
void NotifyNx2NWithMalformedUpdates() throws IOException, IllegalArgumentException, SEPAProtocolException, InterruptedException, SEPAPropertiesException, SEPASecurityException {
    int n = 4;
    for (int i = 0; i < n; i++) {
        subscribers.add(new Subscriber(provider, "RANDOM", sync));
        publishers.add(new Publisher(provider, "RANDOM", n));
        publishers.add(new Publisher(provider, "WRONG", n));
    }
    for (Subscriber sub : subscribers) sub.start();
    sync.waitSubscribes(subscribers.size());
    sync.waitEvents(subscribers.size());
    for (Publisher pub : publishers) pub.start();
    sync.waitEvents(subscribers.size() + subscribers.size() * (publishers.size() / 2) * (publishers.size() / 2));
    assertFalse(sync.getSubscribes() != subscribers.size(), "Subscribes:" + sync.getSubscribes() + "(" + subscribers.size() + ")");
    assertFalse(sync.getEvents() != subscribers.size() + subscribers.size() * (publishers.size() / 2) * (publishers.size() / 2), "Events:" + sync.getEvents() + "(" + subscribers.size() + subscribers.size() * (publishers.size() / 2) * (publishers.size() / 2) + ")");
}
Also used : Subscriber(it.unibo.arces.wot.sepa.Subscriber) Publisher(it.unibo.arces.wot.sepa.Publisher) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Example 2 with Publisher

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

the class StressUsingSPARQLProtocol method NotifyNxN.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
public // @Timeout(60)
void NotifyNxN() throws IOException, IllegalArgumentException, SEPAProtocolException, InterruptedException, SEPAPropertiesException, SEPASecurityException {
    int n = 10;
    for (int i = 0; i < n; i++) {
        subscribers.add(new Subscriber(provider, "RANDOM", sync));
        publishers.add(new Publisher(provider, "RANDOM", n));
    }
    for (Subscriber sub : subscribers) sub.start();
    sync.waitSubscribes(subscribers.size());
    sync.waitEvents(subscribers.size());
    for (Publisher pub : publishers) pub.start();
    sync.waitEvents(subscribers.size() + subscribers.size() * publishers.size() * publishers.size());
    assertFalse(sync.getSubscribes() != subscribers.size(), "Subscribes:" + sync.getSubscribes() + "(" + subscribers.size() + ")");
    assertFalse(sync.getEvents() != subscribers.size() + subscribers.size() * publishers.size() * publishers.size(), "Events:" + sync.getEvents() + "(" + subscribers.size() + subscribers.size() * publishers.size() * publishers.size() + ")");
}
Also used : Subscriber(it.unibo.arces.wot.sepa.Subscriber) Publisher(it.unibo.arces.wot.sepa.Publisher) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Example 3 with Publisher

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

the class StressUsingSPARQLProtocol method Notify3Nx2N.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(60)
public void Notify3Nx2N() throws IOException, IllegalArgumentException, SEPAProtocolException, InterruptedException, SEPAPropertiesException, SEPASecurityException {
    int n = 10;
    for (int i = 0; i < n; i++) {
        subscribers.add(new Subscriber(provider, "ALL", sync));
        subscribers.add(new Subscriber(provider, "RANDOM", sync));
        subscribers.add(new Subscriber(provider, "RANDOM1", sync));
        publishers.add(new Publisher(provider, "RANDOM", n));
        publishers.add(new Publisher(provider, "RANDOM1", n));
    }
    int events = 4 * n * n * n + subscribers.size();
    for (Subscriber sub : subscribers) sub.start();
    sync.waitSubscribes(subscribers.size());
    sync.waitEvents(subscribers.size());
    for (Publisher pub : publishers) pub.start();
    sync.waitEvents(events);
    assertFalse(sync.getSubscribes() != subscribers.size(), "Subscribes:" + sync.getSubscribes() + "(" + subscribers.size() + ")");
    assertFalse(sync.getEvents() != events, "Events:" + sync.getEvents() + "(" + events + ")");
}
Also used : Subscriber(it.unibo.arces.wot.sepa.Subscriber) Publisher(it.unibo.arces.wot.sepa.Publisher) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Timeout(org.junit.jupiter.api.Timeout)

Example 4 with Publisher

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

the class StressUsingSPARQLProtocol method endTest.

@AfterEach
public void endTest() throws IOException, InterruptedException {
    for (Subscriber sub : subscribers) sub.close();
    for (Publisher pub : publishers) pub.close();
    client.close();
    provider.close();
}
Also used : Subscriber(it.unibo.arces.wot.sepa.Subscriber) Publisher(it.unibo.arces.wot.sepa.Publisher) AfterEach(org.junit.jupiter.api.AfterEach)

Example 5 with Publisher

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

the class StressUsingSPARQLProtocol method UpdateHeavyLoad.

@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(30)
public void UpdateHeavyLoad() throws InterruptedException, SEPAPropertiesException, SEPASecurityException {
    int n = 10;
    for (int i = 0; i < n; i++) {
        publishers.add(new Publisher(provider, "RANDOM", n));
        publishers.add(new Publisher(provider, "RANDOM1", n));
        publishers.add(new Publisher(provider, "VAIMEE", n));
    }
    for (Publisher pub : publishers) pub.start();
    // Wait all publishers to complete
    for (Publisher pub : publishers) pub.join();
}
Also used : Publisher(it.unibo.arces.wot.sepa.Publisher) RepeatedTest(org.junit.jupiter.api.RepeatedTest) Timeout(org.junit.jupiter.api.Timeout)

Aggregations

Publisher (it.unibo.arces.wot.sepa.Publisher)5 Subscriber (it.unibo.arces.wot.sepa.Subscriber)4 RepeatedTest (org.junit.jupiter.api.RepeatedTest)4 Timeout (org.junit.jupiter.api.Timeout)2 AfterEach (org.junit.jupiter.api.AfterEach)1