Permalink
Browse files

Fix full test running

  • Loading branch information...
1 parent b193fe0 commit 3b4c630ea77c4ec450937abdc15f56c03b6f11a4 @ghelmling committed Feb 22, 2010
@@ -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 );
+ }
}
/**
@@ -132,6 +143,13 @@ public ComplexEntity(String id, List<String> strings, Set<Integer> ints) {
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")
@@ -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)
@@ -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():
@@ -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():
@@ -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 )
@@ -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.