Package com.clarkparsia.empire.api

Examples of com.clarkparsia.empire.api.TestDataSource


    RdfGenerator.asRdf(new TestPerson());
  }

  @Test(expected=InvalidRdfException.class)
  public void testNoDefaultConstructor() throws InvalidRdfException, DataSourceException {
    RdfGenerator.fromRdf(NoDefaultConstructor.class, URI.create("urn:foo"), new TestDataSource());
  }
View Full Code Here


    RdfGenerator.fromRdf(NoDefaultConstructor.class, URI.create("urn:foo"), new TestDataSource());
  }

  @Test(expected=InvalidRdfException.class)
  public void testUnreachableConstructor() throws InvalidRdfException, DataSourceException {
    RdfGenerator.fromRdf(UnreachableConstructor.class, URI.create("urn:foo"), new TestDataSource());
  }
View Full Code Here

  }

  @Test
  public void testNoStatements() throws InvalidRdfException, DataSourceException {
    // we should at least return an object in these cases.
    assertFalse(RdfGenerator.fromRdf(TestPerson.class, URI.create("urn:foo"), new TestDataSource()) == null);
  }
View Full Code Here

      Graph aSourceGraph = new GraphImpl();
      aSourceGraph.addAll(aGraph);
      aSourceGraph.addAll(RdfGenerator.asRdf(aJoe));
      aSourceGraph.addAll(RdfGenerator.asRdf(aJane));

      TestPerson aPerson = RdfGenerator.fromRdf(TestPerson.class, aBob.getRdfId(), new TestDataSource(aSourceGraph));

      assertEquals(aBob, aPerson);

      // now lets test the round trip w/ the added trick of a circular dependency
      aBob.setSpouse(aJane);

      aGraph = RdfGenerator.asRdf(aBob);

      // this is the set of data that would normally be in the database
      aSourceGraph = new GraphImpl();
      aSourceGraph.addAll(aGraph);
      aSourceGraph.addAll(RdfGenerator.asRdf(aJoe));
      aSourceGraph.addAll(RdfGenerator.asRdf(aJane));

      aPerson = RdfGenerator.fromRdf(TestPerson.class, aBob.getRdfId(), new TestDataSource(aSourceGraph));

      // should still be equal, should have re-used Jane
      assertEquals(aBob, aPerson);
    }
    catch (Exception e) {
View Full Code Here

            Graph aGraph = RdfGenerator.asRdf( root );

            Graph aSourceGraph = new GraphImpl();
            aSourceGraph.addAll(aGraph);

            MyRootClass aRoot = RdfGenerator.fromRdf(MyRootClass.class, "urn:id:00", new TestDataSource(aSourceGraph));
            assertSame( aRoot.getFoo().get( 0 ).getClass(), aImpl.getClass() );
        } catch ( Exception e ) {
            e.printStackTrace();
            fail( e.getMessage() );
        }
View Full Code Here

TOP

Related Classes of com.clarkparsia.empire.api.TestDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.