use of org.junit.jupiter.api.Timeout 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 org.junit.jupiter.api.Timeout in project SEPA by arces-wot.
the class ITPattern method produce.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void produce() throws InterruptedException, SEPASecurityException, IOException, SEPAPropertiesException, SEPAProtocolException, SEPABindingsException {
randomProducer = new Producer(provider.getJsap(), "RANDOM");
Response ret = randomProducer.update(provider.TIMEOUT, provider.NRETRY);
assertFalse(ret.isError(), ret.toString());
}
use of org.junit.jupiter.api.Timeout in project SEPA by arces-wot.
the class StressUsingSPARQLProtocol method Subscribe3xN.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(60)
public void Subscribe3xN() throws SEPAPropertiesException, SEPASecurityException, SEPAProtocolException, InterruptedException {
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));
}
for (Subscriber sub : subscribers) sub.start();
sync.waitSubscribes(subscribers.size());
sync.waitEvents(subscribers.size());
assertFalse(sync.getSubscribes() != subscribers.size(), "Subscribes:" + sync.getSubscribes() + "(" + subscribers.size() + ")");
assertFalse(sync.getEvents() != subscribers.size(), "Events:" + sync.getEvents() + "(" + subscribers.size() + ")");
}
use of org.junit.jupiter.api.Timeout in project SEPA by arces-wot.
the class ITWebSocketSubscriptionProtocol method Subscribe.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(5)
public void Subscribe() throws SEPAPropertiesException, SEPASecurityException, 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();
}
client.close();
}
use of org.junit.jupiter.api.Timeout in project neo4j by neo4j.
the class DijkstraIncreasingWeightTest method testForLoops.
@Test
@Timeout(5)
void testForLoops() {
/*
*
* (b)
* / \ 0
* 0 0 / \ - 0 - (c1) - 0 -
* \ / \/ / \
* (s) - 1 - (a1) - 1 - (a2) - 1 - (a3) (a4) - 1 - (t)
* \ /
* - 0 - (c2) - 0 -
*
*/
try (Transaction transaction = graphDb.beginTx()) {
Node s = graph.makeNode(transaction, "s");
Node t = graph.makeNode(transaction, "t");
// Blob loop
graph.makeEdge(transaction, "s", "a1", "length", 1);
graph.makeEdge(transaction, "a1", "b", "length", 0);
graph.makeEdge(transaction, "b", "a1", "length", 0);
// Self loop
graph.makeEdge(transaction, "a1", "a2", "length", 1);
graph.makeEdge(transaction, "a2", "a2", "length", 0);
// Diamond loop
graph.makeEdge(transaction, "a2", "a3", "length", 1);
graph.makeEdge(transaction, "a3", "c1", "length", 0);
graph.makeEdge(transaction, "a3", "c2", "length", 0);
graph.makeEdge(transaction, "c1", "a4", "length", 0);
graph.makeEdge(transaction, "c1", "a4", "length", 0);
graph.makeEdge(transaction, "a4", "t", "length", 1);
PathExpander<Double> expander = PathExpanders.allTypesAndDirections();
Dijkstra algo = new Dijkstra(expander, CommonEvaluators.doubleCostEvaluator("length"), DEFAULT_EPSILON, PathInterestFactory.all(DEFAULT_EPSILON));
Iterator<WeightedPath> paths = algo.findAllPaths(s, t).iterator();
assertTrue(paths.hasNext(), "Expected at least one path");
assertEquals(6, paths.next().length(), "Expected first path of length 6");
assertTrue(paths.hasNext(), "Expected at least two paths");
assertEquals(6, paths.next().length(), "Expected second path of length 6");
assertFalse(paths.hasNext(), "Expected exactly two paths");
transaction.commit();
}
}
Aggregations