def test_rowkey(): # entity with no row key mapping metadata = EntityMetadata.getInstance() try: nokeyinfo = metadata.getInfo(TestEntities.NoKeyEntity) fail("EntityMetadata should have failed parsing NoKeyEntity due to missing HRowKey") except MappingException, me: assertMatches(me.getMessage(), "Missing .* row key property")
def test_rowkey(): # entity with no row key mapping metadata = EntityMetadata.getInstance() try: nokeyinfo = metadata.getInfo(TestEntities.NoKeyEntity) fail( "EntityMetadata should have failed parsing NoKeyEntity due to missing HRowKey" ) except MappingException, me: assertMatches(me.getMessage(), "Missing .* row key property")
def run(self): metadata = EntityMetadata.getInstance() iteminfo = metadata.getInfo(self.entitycls) assertEquals(iteminfo.getTablename(), self.tablename) keyprop = iteminfo.getKeyProperty() assertNotNull(keyprop) assertEquals(keyprop.getName(), "id") for field, propname in self.fieldprops.items(): prop = iteminfo.getFieldProperty(field) assertNotNull(prop) assertEquals(prop.getName(), propname)
def test_indexes(): metadata = EntityMetadata.getInstance() idxinfo = metadata.getInfo(TestEntities.IndexedEntity) idxmapping = idxinfo.getFirstPropertyIndex("stringProperty") assertNotNull(idxmapping) assertEquals(idxmapping.getTableName(), "test_indexed-by_stringcol")