Package org.springframework.data.neo4j.core

Examples of org.springframework.data.neo4j.core.GraphDatabase


    @Test
    public void shouldCreateLocalDatabaseFromContext() throws Exception {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("GraphDatabaseFactory-context.xml");
        try {
            GraphDatabase graphDatabase = ctx.getBean("graphDatabase", GraphDatabase.class);
            assertThat(graphDatabase, is(not(nullValue())));
            assertThat(graphDatabase, is(instanceOf(DelegatingGraphDatabase.class)));
        } finally {
            ctx.close();
        }
View Full Code Here


    @Test
    public void shouldCreateLocalDatabase() throws Exception {
        GraphDatabaseFactory factory = new GraphDatabaseFactory();
        try {
            factory.setStoreLocation("target/test-db");
            GraphDatabase graphDatabase = factory.getObject();
            assertThat(graphDatabase, is(not(nullValue())));
            assertThat(graphDatabase,is(instanceOf(DelegatingGraphDatabase.class)));
        } finally {
            factory.shutdown();
        }
View Full Code Here

    @Override
    protected GraphDatabase createGraphDatabase() throws Exception
    {
        testHelper.cleanDb();
        final GraphDatabase graphDatabase = testHelper.createGraphDatabase();
        graphDatabase.setConversionService(conversionService);
        return graphDatabase;
    }
View Full Code Here

    @Test
    public void shouldCreateLocalDatabaseFromContext() throws Exception {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("GraphDatabaseFactory-context.xml");
        try {
            GraphDatabase graphDatabase = ctx.getBean("graphDatabase", GraphDatabase.class);
            Assert.assertThat(graphDatabase, Is.is(IsNot.not(IsNull.nullValue())));
            Assert.assertThat(graphDatabase, Is.is(IsInstanceOf.instanceOf(DelegatingGraphDatabase.class)));
        } finally {
            ctx.close();
        }
View Full Code Here

    @Test
    public void shouldCreateLocalDatabase() throws Exception {
        GraphDatabaseFactoryBean factory = new GraphDatabaseFactoryBean();
        try {
            factory.setStoreLocation("target/test-db");
            GraphDatabase graphDatabase = factory.getObject();
            Assert.assertThat(graphDatabase, Is.is(IsNot.not(IsNull.nullValue())));
            Assert.assertThat(graphDatabase, Is.is(IsInstanceOf.instanceOf(DelegatingGraphDatabase.class)));
        } finally {
            factory.shutdown();
        }
View Full Code Here

    @Override
    protected GraphDatabase createGraphDatabase() throws Exception
    {
        testHelper.cleanDb();
        final GraphDatabase graphDatabase = testHelper.createGraphDatabase();
        graphDatabase.setConversionService(conversionService);
        return graphDatabase;
    }
View Full Code Here

  }

  @Test
  public void testRepositoryStyle1IsCreatedCorrectly() {

    GraphDatabase database = container.getInstance(GraphDatabase.class);
    RepositoryClient client = container.getInstance(RepositoryClient.class);
    CdiPersonRepository repository = client.repository;

    assertThat(repository, is(notNullValue()));

    Person person = null;
    Person result = null;

    try (Transaction tx = database.beginTx()) {
      repository.deleteAll();

      person = new Person("Simon", 28);
      result = repository.save(person);
      tx.success();
    }

        try (Transaction tx = database.beginTx()) {
            assertThat(result, is(notNullValue()));
            Long resultId = result.getId();
            Person lookedUpPerson = repository.findOne(person.getId());
            assertThat(lookedUpPerson.getId(), is(resultId));
            tx.success();
View Full Code Here

  }

  @Test
  public void testRepositoryStyle2IsCreatedCorrectly() {

    GraphDatabase database = container.getInstance(GraphDatabase.class);
    RepositoryClient client = container.getInstance(RepositoryClient.class);
    CdiPersonRepository2 repository = client.repository2;

    assertThat(repository, is(notNullValue()));

    Person person = null;
    Person result = null;

    try (Transaction tx = database.beginTx()) {
      repository.deleteAll();

      person = new Person("Simon", 28);
      result = repository.save(person);
      tx.success();
    }

        try (Transaction tx = database.beginTx()) {
            assertThat(result, is(notNullValue()));
            Long resultId = result.getId();
            Person lookedUpPerson = repository.findOne(person.getId());
            assertThat(lookedUpPerson.getId(), is(resultId));
            tx.success();
View Full Code Here

  }

  @Test
  public void neo4jCrudRepositorySubTypeWorks() {

    GraphDatabase database = container.getInstance(GraphDatabase.class);
    RepositoryClient client = container.getInstance(RepositoryClient.class);
    CdiPersonRepository3 repository = client.repository3;

    assertThat(repository, is(notNullValue()));

    Person person = null;
    Person result = null;

    try (Transaction tx = database.beginTx()) {
      repository.deleteAll();

      person = new Person("Simon", 28);
      result = repository.save(person);
      tx.success();
    }

        try (Transaction tx = database.beginTx()) {
            assertThat(result, is(notNullValue()));
            Long resultId = result.getId();
            Person lookedUpPerson = repository.findOne(person.getId());
            assertThat(lookedUpPerson.getId(), is(resultId));
            tx.success();
View Full Code Here

   * @see DATAGRAPH-500
   */
  @Test
  public void returnOneFromCustomImpl() {

    GraphDatabase database = container.getInstance(GraphDatabase.class);

    try (Transaction tx = database.beginTx()) {

      RepositoryClient client = container.getInstance(RepositoryClient.class);
      assertThat(client.samplePersonRepository.returnOne(), is(1));
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.core.GraphDatabase

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.