예제 #1
0
def query_by_int():
    srv = EntityService(TestEntities.IndexedEntity)
    # test indexing of integer values
    q = srv.query()
    q.using( Criteria.eq( "intKey", java.lang.Integer(2) ) )
    matches = q.execute()
    print matches
    assertEquals( len(matches), 3 )
    assertEquals( matches[0].getId(), 'e4', "Indexed entries should be in reverse timestamp order" )
    assertEquals( matches[0].getIntKey(), 2 )
    assertEquals( matches[1].getId(), 'e3', "Indexed entries should be in reverse timestamp order" )
    assertEquals( matches[1].getIntKey(), 2 )
    assertEquals( matches[2].getId(), 'e2', "Indexed entries should be in reverse timestamp order" )
    assertEquals( matches[2].getIntKey(), 2 )

    q = srv.query()
    q.using( Criteria.eq( "intKey", java.lang.Integer(1) ) )
    matches = q.execute()
    assertEquals( len(matches), 1 )
    assertEquals( matches[0].getId(), 'e1' )
    assertEquals( matches[0].getIntKey(), 1 )
예제 #2
0
def query_by_string():
    srv = EntityService(TestEntities.IndexedEntity)
    # test indexing of a value with multiple entries
    q = srv.query()
    q.using(Criteria.eq("stringProperty", java.lang.String('duck')))
    matches = q.execute()

    assertEquals(len(matches), 3)
    assertEquals(matches[0].getId(), 'e1')
    assertEquals(matches[0].getStringProperty(), 'duck')
    assertEquals(matches[1].getId(), 'e2')
    assertEquals(matches[1].getStringProperty(), 'duck')
    assertEquals(matches[2].getId(), 'e3')
    assertEquals(matches[2].getStringProperty(), 'duck')

    q = srv.query()
    q.using(Criteria.eq("stringProperty", java.lang.String('goose')))
    matches = q.execute()
    assertEquals(len(matches), 1)
    assertEquals(matches[0].getId(), 'e4')
    assertEquals(matches[0].getStringProperty(), 'goose')
예제 #3
0
def query_by_string():
    srv = EntityService(TestEntities.IndexedEntity)
    # test indexing of a value with multiple entries
    q = srv.query()
    q.using( Criteria.eq( "stringProperty", java.lang.String('duck') ) )
    matches = q.execute()

    assertEquals( len(matches), 3 )
    assertEquals( matches[0].getId(), 'e1' )
    assertEquals( matches[0].getStringProperty(), 'duck' )
    assertEquals( matches[1].getId(), 'e2' )
    assertEquals( matches[1].getStringProperty(), 'duck' )
    assertEquals( matches[2].getId(), 'e3' )
    assertEquals( matches[2].getStringProperty(), 'duck' )

    q = srv.query()
    q.using( Criteria.eq( "stringProperty", java.lang.String('goose') ) )
    matches = q.execute()
    assertEquals( len(matches), 1 )
    assertEquals( matches[0].getId(), 'e4' )
    assertEquals( matches[0].getStringProperty(), 'goose' )
예제 #4
0
def query_by_int():
    srv = EntityService(TestEntities.IndexedEntity)
    # test indexing of integer values
    q = srv.query()
    q.using(Criteria.eq("intKey", java.lang.Integer(2)))
    matches = q.execute()
    print matches
    assertEquals(len(matches), 3)
    assertEquals(matches[0].getId(), 'e4',
                 "Indexed entries should be in reverse timestamp order")
    assertEquals(matches[0].getIntKey(), 2)
    assertEquals(matches[1].getId(), 'e3',
                 "Indexed entries should be in reverse timestamp order")
    assertEquals(matches[1].getIntKey(), 2)
    assertEquals(matches[2].getId(), 'e2',
                 "Indexed entries should be in reverse timestamp order")
    assertEquals(matches[2].getIntKey(), 2)

    q = srv.query()
    q.using(Criteria.eq("intKey", java.lang.Integer(1)))
    matches = q.execute()
    assertEquals(len(matches), 1)
    assertEquals(matches[0].getId(), 'e1')
    assertEquals(matches[0].getIntKey(), 1)