Package org.hibernate.ogm.test.integration.jboss.model

Examples of org.hibernate.ogm.test.integration.jboss.model.Member


    return buildDirectory + File.separator + "NEO4J-DB" + File.separator + System.currentTimeMillis();
  }

  @Test
  public void shouldFindPersistedMemberByIdWithNativeQuery() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Giovanni Doe" );
    memberRegistration.register();

    String nativeQuery = "MATCH (n:Member {id: " + newMember.getId() + "}) RETURN n";
    Member found = memberRegistration.findWithNativeQuery( nativeQuery );

    assertNotNull( "Expected at least one result using a native query", found );
    assertEquals( "Native query hasn't found a new member", newMember.getName(), found.getName() );
  }
View Full Code Here


    return mongoHostName != null && mongoHostName.length() > 0 && ! "null".equals( mongoHostName );
  }

  @Test
  public void shouldFindPersistedMemberByIdWithNativeQuery() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Peter O'Tall" );
    memberRegistration.register();

    String nativeQuery = "{ _id: " + newMember.getId() + " }";
    Member found = memberRegistration.findWithNativeQuery( nativeQuery );

    assertNotNull( "Expected at least one result using a native query", found );
    assertEquals( "Native query hasn't found a new member", newMember.getName(), found.getName() );
  }
View Full Code Here

    memberRegistration.close();
  }

  @Test
  public void shouldGenerateAnId() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Davide D'Alto" );
    memberRegistration.register();

    assertNotNull( newMember.getId() );
  }
View Full Code Here

    assertNotNull( newMember.getId() );
  }

  @Test
  public void shouldFindPersistedMemberById() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Peter O'Tall" );
    newMember.getAddresses().add( new Address( "Mulholland Drive", "Los Angeles" ) );
    memberRegistration.register();

    Member found = memberRegistration.find( newMember.getId() );

    assertNotNull( "Expected at least one result after the indexing", found );
    assertEquals( "Search hasn't found a new member", newMember.getName(), found.getName() );
    assertEquals( "Member should have one address", 1, found.getAddresses().size() );
    assertEquals(
        "Member should have address with correct street",
        "Mulholland Drive",
        found.getAddresses().iterator().next().getStreet()
    );
  }
View Full Code Here

    );
  }

  @Test
  public void shouldFindPersistedMemberByIdWithQuery() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Peter O'Tall" );
    newMember.getAddresses().add( new Address( "Mulholland Drive", "Los Angeles" ) );
    memberRegistration.register();

    Member found = memberRegistration.findWithQuery( newMember.getId() );

    assertNotNull( "Expected at least one result using HQL", found );
    assertEquals( "HQL hasn't found a new member", newMember.getName(), found.getName() );
    assertEquals( "Member should have one address", 1, found.getAddresses().size() );
    assertEquals(
        "Member should have address with correct street",
        "Mulholland Drive",
        found.getAddresses().iterator().next().getStreet()
    );
  }
View Full Code Here

    );
  }

  @Test
  public void shouldBeAbleToFindMemberByEmail() throws Exception {
    Member newMember = memberRegistration.getNewMember();
    newMember.setName( "Sherlock Holmes" );
    newMember.setEmail( "SherlockHolmes@consultingdetective.co.uk" );
    newMember.getAddresses().add( new Address( "221B Baker St", "London" ) );
    memberRegistration.register();

    Member found = memberRegistration.findWithEmail( "she*" );

    assertNotNull( "Expected at least one result using Full text query", found );
    assertEquals( "Full text query hasn't found a new member", newMember.getName(), found.getName() );
    assertEquals( "Member should have one address", 1, found.getAddresses().size() );
    assertEquals(
        "Member should have address with correct street",
        "221B Baker St",
        found.getAddresses().iterator().next().getStreet()
    );
  }
View Full Code Here

    );
  }

  @Test
  public void shouldReturnNullWhenIdDoesNotExist() throws Exception {
    Member found = memberRegistration.find( -12L );

    assertNull( "Should return null when the id doesn't exist", found );
  }
View Full Code Here

    return RegistrationExecutor.findWithEmail( em, email );
  }

  @PostConstruct
  public void initNewMember() {
    newMember = new Member();
  }
View Full Code Here

  }

  @Override
  public Member find(Long id) {
    beginTransaction();
    Member member = RegistrationExecutor.find( em, id );
    commit();
    return member;
  }
View Full Code Here

  }

  @Override
  public Member findWithNativeQuery(String nativeQuery) {
    beginTransaction();
    Member member = RegistrationExecutor.findWithNativeQuery( em, nativeQuery );
    commit();
    return member;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.test.integration.jboss.model.Member

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.