private void addTestRequirements( Model earl, TestInfo testInfo ) { Resource testReq = earl.createResource( testInfo.testName.replaceAll( "\\s", "-" ), EARL.TestRequirement ); testReq.addProperty( DCTerms.title, testInfo.testName ); testReq.addProperty( CITE.isBasic, Boolean.toString( testInfo.isBasic ) ); this.reqs.add( testReq ); }
private void addTestRequirements( Model earl, TestInfo testInfo ) { Resource testReq = earl.createResource( testInfo.testName.replaceAll( "\\s", "-" ), EARL.TestRequirement ); testReq.addProperty( DCTerms.title, testInfo.testName ); testReq.addProperty( CITE.isBasic, Boolean.toString( testInfo.isBasic ) ); this.reqs.add( testReq ); }
@Override public SecuredSeq add(final int index, final RDFNode o) throws UpdateDeniedException, AddDeniedException, AuthenticationRequiredException { checkUpdate(); final Literal l = holder.getBaseItem().getModel().createTypedLiteral(o); checkCreate(index, l); holder.getBaseItem().add(index, o); return holder.getSecuredItem(); }
public void testSeqAddInts() { final int num = 10; final Seq seq = model.createSeq(); for (int i = 0; i < num; i += 1) { seq.add(i); } Assert.assertEquals(num, seq.size()); final List<RDFNode> L = seq.iterator().toList(); Assert.assertEquals(num, L.size()); for (int i = 0; i < num; i += 1) { Assert.assertEquals(i, ((Literal) L.get(i)).getInt()); } }
public void testSeqAddInts() { final int num = 10; final Seq seq = model.createSeq(); for (int i = 0; i < num; i += 1) { seq.add(i); } Assert.assertEquals(num, seq.size()); final List<RDFNode> L = seq.iterator().toList(); Assert.assertEquals(num, L.size()); for (int i = 0; i < num; i += 1) { Assert.assertEquals(i, ((Literal) L.get(i)).getInt()); } }
@Test public void testGetDouble() { seq.add(2, 3.14D); try { getSecuredSeq().getDouble(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetByte() { seq.add(2, Byte.MAX_VALUE); try { getSecuredSeq().getByte(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetFloat() { seq.add(2, 3.14F); try { getSecuredSeq().getFloat(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetInt() { seq.add(2, 2); try { getSecuredSeq().getInt(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetShort() { seq.add(2, Short.MAX_VALUE); try { getSecuredSeq().getShort(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetBoolean() { seq.add(2, true); try { getSecuredSeq().getBoolean(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetChar() { seq.add(2, 'c'); try { getSecuredSeq().getChar(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetLanguage() { seq.add(2, "foo"); try { getSecuredSeq().getLanguage(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetSeq() { seq.add(2, 'c'); try { getSecuredSeq().getSeq(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetLiteral() { seq.add(2, "foo"); try { getSecuredSeq().getLiteral(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetLong() { seq.add(2, 2L); try { getSecuredSeq().getLong(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetString() { seq.add(2, "Waaa hoo"); try { getSecuredSeq().getString(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetObject() { final Object o = Integer.MAX_VALUE; seq.add(2, o); try { getSecuredSeq().getObject(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }
@Test public void testGetResource() { seq.add(2, ResourceFactory.createResource()); try { getSecuredSeq().getResource(2); if (!securityEvaluator.evaluate(Action.Read)) { Assert.fail("Should have thrown ReadDeniedException Exception"); } } catch (final ReadDeniedException e) { if (securityEvaluator.evaluate(Action.Read)) { Assert.fail(String .format("Should not have thrown ReadDeniedException Exception: %s - %s", e, e.getTriple())); } } }