use of it.unibo.arces.wot.sepa.ConsumerTestUnit in project SEPA by arces-wot.
the class ITPattern method notification.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void notification() throws InterruptedException, SEPASecurityException, IOException, SEPAPropertiesException, SEPAProtocolException, SEPABindingsException {
consumerAll = new ConsumerTestUnit(provider, "ALL");
consumerAll.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
randomProducer = new Producer(provider.getJsap(), "RANDOM");
Response ret = randomProducer.update(provider.TIMEOUT, provider.NRETRY);
assertFalse(ret.isError(), ret.toString());
consumerAll.waitNotification();
}
use of it.unibo.arces.wot.sepa.ConsumerTestUnit in project SEPA by arces-wot.
the class ITPattern method aggregation.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void aggregation() throws InterruptedException, SEPASecurityException, IOException, SEPAPropertiesException, SEPAProtocolException, SEPABindingsException {
logger.debug("Aggregator");
consumerRandom1 = new ConsumerTestUnit(provider, "RANDOM1");
consumerRandom1.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
logger.debug("Aggregator first subscribe ok");
randomAggregator = new AggregatorTestUnit(provider, "RANDOM", "RANDOM1");
randomAggregator.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
logger.debug("Aggregator second subscribe ok");
randomProducer = new Producer(provider.getJsap(), "RANDOM");
Response ret = randomProducer.update(provider.TIMEOUT, provider.NRETRY);
assertFalse(ret.isError(), ret.toString());
logger.debug("Aggregator Update Done");
randomAggregator.waitNotification();
consumerRandom1.waitNotification();
logger.debug("Aggregator stop");
}
use of it.unibo.arces.wot.sepa.ConsumerTestUnit in project SEPA by arces-wot.
the class StressUsingPAC method subscribeAndUpdateRaceDetection.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
public // @Timeout(10)
void subscribeAndUpdateRaceDetection() throws InterruptedException, SEPASecurityException, IOException, SEPAPropertiesException, SEPAProtocolException, SEPABindingsException {
Thread pub = new Thread() {
public void run() {
for (int i = 0; i < 500; i++) {
try {
randomProducer.update(provider.TIMEOUT, provider.NRETRY);
} catch (SEPASecurityException | SEPAPropertiesException | SEPABindingsException | SEPAProtocolException e) {
assertFalse(true, "Failed on update: " + i + " " + e.getMessage());
}
}
}
};
Thread sub = new Thread() {
public void run() {
for (int i = 0; i < 500; i++) {
try {
consumerRandom1 = new ConsumerTestUnit(provider, "RANDOM1");
consumerRandom1.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
consumerRandom1.close();
consumerAll = new ConsumerTestUnit(provider, "ALL");
consumerAll.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
consumerAll.close();
} catch (SEPASecurityException | SEPAPropertiesException | SEPABindingsException | SEPAProtocolException | IOException | InterruptedException e) {
assertFalse(true, "Failed on subscribe: " + i + " " + e.getMessage());
}
}
}
};
pub.start();
sub.start();
synchronized (pub) {
pub.wait();
}
synchronized (sub) {
sub.wait();
}
}
use of it.unibo.arces.wot.sepa.ConsumerTestUnit in project SEPA by arces-wot.
the class StressUsingPAC method beginTest.
@BeforeEach
public void beginTest() throws SEPAProtocolException, SEPASecurityException, SEPAPropertiesException {
consumerAll = new ConsumerTestUnit(provider, "ALL");
randomProducer = new Producer(provider.getJsap(), "RANDOM");
randomAggregator = new AggregatorTestUnit(provider, "RANDOM", "RANDOM1");
consumerRandom1 = new ConsumerTestUnit(provider, "RANDOM1");
genericClient = new GenericClient(provider.getJsap(), this);
}
use of it.unibo.arces.wot.sepa.ConsumerTestUnit in project SEPA by arces-wot.
the class ITPattern method subscribeAndResults.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void subscribeAndResults() throws InterruptedException, SEPASecurityException, IOException, SEPAPropertiesException, SEPAProtocolException, SEPABindingsException {
consumerAll = new ConsumerTestUnit(provider, "ALL");
consumerAll.syncSubscribe(provider.TIMEOUT, provider.NRETRY);
consumerAll.waitFirstNotification();
}
Aggregations