Skip to content

Commit

Permalink
Fix full test running
Browse files Browse the repository at this point in the history
  • Loading branch information
ghelmling committed Feb 22, 2010
1 parent b193fe0 commit 3b4c630
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
18 changes: 18 additions & 0 deletions test/java/meetup/beeno/TestEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ public void setDoubleProperty( double doubleProperty ) {
public void setLongProperty( long longProperty ) {
this.longProperty = longProperty;
}

public String toString() {
return String.format( "[%s: id=%s, stringProperty=%s, intProperty=%d, floatProperty=%f, doubleProperty=%f, longProperty=%d]",
this.getClass().getSimpleName(),
this.id,
(this.stringProperty == null ? "NULL" : this.stringProperty),
this.intProperty,
this.floatProperty,
this.doubleProperty,
this.longProperty );
}
}

/**
Expand Down Expand Up @@ -132,6 +143,13 @@ public Map<String, String> getExtendedProps() {
public void setExtendedProps(Map<String,String> props) {
this.extendedMap = props;
}
public String toString() {
return String.format( "[%s: id=%s, stringList=%s, intSet=%s, extendedProps=%s]",
this.id,
(this.stringList == null ? "NULL" : this.stringList.toString()),
(this.intSet == null ? "NULL" : this.intSet.toString()),
(this.extendedMap == null ? "NULL" : this.extendedMap.toString()) );
}
}

@HEntity(name="test_nokey")
Expand Down
12 changes: 12 additions & 0 deletions test/jython/dbtest/hbase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ def __init__(self):
if self.conf.get('test.build.data') is None:
self.conf.set('test.build.data', '/tmp/beeno')

self.running = False

def setUp(self):
if not self.running:
self.running = True
HBaseClusterTestCase.setUp(self)


def tearDown(self):
if self.running:
self.running = False
HBaseClusterTestCase.tearDown(self)
14 changes: 8 additions & 6 deletions test/jython/dbtest/hbase/test_entity_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ def teardown():
import db.hbase
admin = db.hbase.Admin(hc.conf)

#if admin.exists("test_simple"):
# admin.disable("test_simple")
# admin.drop("test_simple")
if admin.exists("test_simple"):
admin.disable("test_simple")
admin.drop("test_simple")

#if admin.exists("test_complex"):
# admin.disable("test_complex")
# admin.drop("test_complex")
if admin.exists("test_complex"):
admin.disable("test_complex")
admin.drop("test_complex")
finally:
hc.tearDown()
# hack to give server time to shutdown
java.lang.Thread.sleep(10000)


def save_and_get():
Expand Down
33 changes: 18 additions & 15 deletions test/jython/dbtest/hbase/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,19 @@ def teardown():
try:
pass
# clean up the dummy table
# import db.hbase
# admin = db.hbase.Admin(hc.conf)

# if admin.exists("test_indexed"):
# admin.drop("test_indexed")
# if admin.exists("test_indexed-by_intcol"):
# admin.drop("test_indexed-by_intcol")
# if admin.exists("test_indexed-by_stringcol"):
# admin.drop("test_indexed-by_stringcol")
import db.hbase
admin = db.hbase.Admin(hc.conf)

if admin.exists("test_indexed"):
admin.drop("test_indexed")
if admin.exists("test_indexed-by_intcol"):
admin.drop("test_indexed-by_intcol")
if admin.exists("test_indexed-by_stringcol"):
admin.drop("test_indexed-by_stringcol")
finally:
hc.tearDown()
# hack to give server time to shutdown
java.lang.Thread.sleep(10000)


def query_by_string():
Expand Down Expand Up @@ -85,6 +87,7 @@ def query_by_int():
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 )
Expand All @@ -102,13 +105,13 @@ def query_by_int():


def run_test():
query_by_string()
query_by_int()


if __name__ == '__main__':
try:
setup()
query_by_string()
query_by_int()
run_test()
finally:
teardown()


if __name__ == '__main__':
run_test()

0 comments on commit 3b4c630

Please sign in to comment.