use of com.walmartlabs.concord.plugins.s3.Result in project java-smt by sosy-lab.
the class CVC4NativeAPITest method checkUnsatCore.
@Test
public void checkUnsatCore() {
// (a & b) & (not(a OR b))
// Enable UNSAT Core first!
smtEngine.setOption("produce-unsat-cores", new SExpr(true));
Type boolType = exprMgr.booleanType();
Expr a = exprMgr.mkVar("a", boolType);
Expr b = exprMgr.mkVar("b", boolType);
Expr aAndb = exprMgr.mkExpr(Kind.AND, a, b);
Expr notaOrb = exprMgr.mkExpr(Kind.NOT, exprMgr.mkExpr(Kind.OR, a, b));
smtEngine.assertFormula(aAndb);
smtEngine.assertFormula(notaOrb);
Result satCheck = smtEngine.checkSat();
assertThat(satCheck.isSat()).isEqualTo(Sat.UNSAT);
UnsatCore unsatCore = smtEngine.getUnsatCore();
// UnsatCores are iterable
for (Expr e : unsatCore) {
assertThat(e.toString()).isIn(Arrays.asList("(not (or a b))", "(and a b)"));
}
}
use of com.walmartlabs.concord.plugins.s3.Result in project java-smt by sosy-lab.
the class CVC4TheoremProver method isUnsat.
@Override
@SuppressWarnings("try")
public boolean isUnsat() throws InterruptedException, SolverException {
Preconditions.checkState(!closed);
closeAllModels();
changedSinceLastSatQuery = false;
if (!incremental) {
for (Expr expr : getAssertedExpressions()) {
smtEngine.assertFormula(importExpr(expr));
}
}
Result result;
try (ShutdownHook hook = new ShutdownHook(shutdownNotifier, smtEngine::interrupt)) {
shutdownNotifier.shutdownIfNecessary();
result = smtEngine.checkSat();
}
shutdownNotifier.shutdownIfNecessary();
return convertSatResult(result);
}
use of com.walmartlabs.concord.plugins.s3.Result in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testSearchByQuery.
@Test
public void testSearchByQuery() {
Search search = new Search();
Result result = new Result();
result.setOrcidIdentifier(new OrcidIdentifier("some-orcid-id"));
search.getResults().add(result);
OrcidSearchManager orcidSearchManager = Mockito.mock(OrcidSearchManagerImpl.class);
Mockito.when(orcidSearchManager.findOrcidIds(Matchers.<Map<String, List<String>>>any())).thenReturn(search);
PublicV2ApiServiceDelegatorImpl delegator = new PublicV2ApiServiceDelegatorImpl();
ReflectionTestUtils.setField(delegator, "orcidSearchManager", orcidSearchManager);
OrcidSecurityManager orcidSecurityManager = Mockito.mock(OrcidSecurityManagerImpl.class);
Mockito.when(orcidSecurityManager.getClientIdFromAPIRequest()).thenReturn(null);
ReflectionTestUtils.setField(delegator, "orcidSecurityManager", orcidSecurityManager);
Response response = delegator.searchByQuery(new HashMap<String, List<String>>());
assertNotNull(response);
assertNotNull(response.getEntity());
assertTrue(response.getEntity() instanceof Search);
assertEquals(1, ((Search) response.getEntity()).getResults().size());
assertEquals("some-orcid-id", ((Search) response.getEntity()).getResults().get(0).getOrcidIdentifier().getPath());
}
use of com.walmartlabs.concord.plugins.s3.Result in project ORCID-Source by ORCID.
the class MemberV2ApiServiceVersionedDelegatorTest method testSearchByQuery.
@Test
public void testSearchByQuery() {
MockitoAnnotations.initMocks(this);
Search search = new Search();
Result result = new Result();
result.setOrcidIdentifier(new OrcidIdentifier("some-orcid-id"));
search.getResults().add(result);
Response searchResponse = Response.ok(search).build();
Mockito.when(mockServiceDelegatorNonVersioned.searchByQuery(Matchers.<Map<String, List<String>>>any())).thenReturn(searchResponse);
TargetProxyHelper.injectIntoProxy(serviceDelegator, "memberV2ApiServiceDelegator", mockServiceDelegatorNonVersioned);
Response response = serviceDelegator.searchByQuery(new HashMap<String, List<String>>());
// just testing MemberV2ApiServiceDelegatorImpl's response is returned
assertNotNull(response);
assertNotNull(response.getEntity());
assertTrue(response.getEntity() instanceof Search);
assertEquals(1, ((Search) response.getEntity()).getResults().size());
assertEquals("some-orcid-id", ((Search) response.getEntity()).getResults().get(0).getOrcidIdentifier().getPath());
TargetProxyHelper.injectIntoProxy(serviceDelegator, "memberV2ApiServiceDelegator", serviceDelegatorNonVersioned);
}
use of com.walmartlabs.concord.plugins.s3.Result in project pravega by pravega.
the class MarathonBasedService method deleteApp.
void deleteApp(final String appID) {
try {
Result result = marathonClient.deleteApp(appID);
log.info("App: {} deleted, Deployment id is: {}", appID, result.getDeploymentId());
waitUntilDeploymentPresent(result.getDeploymentId()).get();
} catch (MarathonException e) {
if (e.getStatus() == NOT_FOUND.getStatusCode()) {
log.debug("Application does not exist");
} else {
throw new TestFrameworkException(RequestFailed, "Marathon Exception while deleting service", e);
}
} catch (InterruptedException | ExecutionException e) {
throw new TestFrameworkException(InternalError, "Exception during deleteApp", e);
}
}
Aggregations