Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed persistence mechanism for hbase

  • Loading branch information...
commit c2f3055eb9c5120b5b40f2ed2e3632b2599482b0 1 parent 79331f5
kkmishra kkmishra authored
Showing with 216 additions and 199 deletions.
  1. +10 −6 kundera-cassandra/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java
  2. +2 −4 kundera-cassandra/src/main/java/com/impetus/client/cassandra/index/InvertedIndexHandlerBase.java
  3. +1 −1  kundera-cassandra/src/test/resources/META-INF/persistence.xml
  4. +1 −1  kundera-core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java
  5. +8 −2 kundera-core/src/main/java/com/impetus/kundera/persistence/AssociationBuilder.java
  6. +3 −5 kundera-core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java
  7. +5 −5 kundera-core/src/test/java/com/impetus/kundera/configure/AbstractPropertyReaderTest.java
  8. +23 −18 kundera-hbase/src/main/java/com/impetus/client/hbase/HBaseClient.java
  9. +5 −3 kundera-hbase/src/main/java/com/impetus/client/hbase/Reader.java
  10. +17 −17 kundera-hbase/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java
  11. +11 −4 kundera-hbase/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
  12. +12 −7 kundera-hbase/src/main/java/com/impetus/client/hbase/service/HBaseReader.java
  13. +3 −3 kundera-hbase/src/main/java/com/impetus/client/hbase/service/HBaseWriter.java
  14. +2 −3 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/HBaseIdQueryTest.java
  15. +1 −1  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/PersonHBase.java
  16. +2 −3 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/PersonHBaseTest.java
  17. +1 −3 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBigDecimalTest.java
  18. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBigIntegerTest.java
  19. +7 −9 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBooleanTest.java
  20. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseByteTest.java
  21. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCalendarTest.java
  22. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCharTest.java
  23. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCharacterTest.java
  24. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseDateTest.java
  25. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseDoubleTest.java
  26. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseFloatTest.java
  27. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseIntTest.java
  28. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseIntegerTest.java
  29. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseLongTest.java
  30. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseShortTest.java
  31. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseSqlDateTest.java
  32. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseStringTest.java
  33. +2 −3 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseTimeTest.java
  34. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseTimestampTest.java
  35. +5 −5 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseUUIDTest.java
  36. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasebooleanTest.java
  37. +12 −9 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasebyteTest.java
  38. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasedoubleTest.java
  39. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasefloatTest.java
  40. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaselongTest.java
  41. +1 −2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseshortTest.java
  42. +2 −1  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHbaseTest.java
  43. +7 −3 kundera-hbase/src/test/java/com/impetus/client/hbase/junits/HBaseCli.java
  44. +15 −16 kundera-hbase/src/test/java/com/impetus/client/twitter/TwibaseTest.java
  45. +2 −2 kundera-hbase/src/test/java/com/impetus/client/twitter/TwitterTestBaseHbase.java
  46. +1 −1  kundera-hbase/src/test/java/com/impetus/client/twitter/entities/UserHBase.java
  47. +15 −1 kundera-hbase/src/test/resources/META-INF/persistence.xml
  48. +5 −2 kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTMBiAssociationTest.java
  49. +1 −1  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTMUniAssociationTest.java
  50. +1 −1  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTOBiAssociationTest.java
  51. +1 −1  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/OTOBiAssociationTest.java
  52. +1 −4 kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/OTOUniAssociationTest.java
  53. +12 −14 kundera-tests/src/test/resources/META-INF/persistence.xml
16 kundera-cassandra/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java
View
@@ -718,37 +718,41 @@ public List executeQuery(String cqlQuery, Class clazz, List<String> relationalFi
{
returnedEntities.add(entity);
}
+ else
+ {
+ returnedEntities.add(row);
+ }
}
}
}
catch (InvalidRequestException e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
throw new PersistenceException(e);
}
catch (UnavailableException e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
throw new PersistenceException(e);
}
catch (TimedOutException e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
throw new PersistenceException(e);
}
catch (SchemaDisagreementException e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
throw new PersistenceException(e);
}
catch (TException e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
throw new PersistenceException(e);
}
catch (Exception e)
{
- log.error("Error while executing native CQL query Caused by:" , e);
+ log.error("Error while executing native CQL query Caused by:", e);
e.printStackTrace();
throw new PersistenceException(e);
}
6 kundera-cassandra/src/main/java/com/impetus/client/cassandra/index/InvertedIndexHandlerBase.java
View
@@ -81,8 +81,7 @@
* search result to <code>searchResults</code>
*/
private void searchAndAddToResults(EntityMetadata m, String persistenceUnit, ConsistencyLevel consistencyLevel,
- String columnFamilyName, List<SearchResult> searchResults, IndexExpression expression,
- boolean isRowKeyQuery)
+ String columnFamilyName, List<SearchResult> searchResults, IndexExpression expression, boolean isRowKeyQuery)
{
SearchResult searchResult = new SearchResult();
@@ -92,7 +91,7 @@ private void searchAndAddToResults(EntityMetadata m, String persistenceUnit, Con
Object pk = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), superColumnName);
IndexOperator condition = expression.getOp();
- log.debug("rowKey:" + rowKey + ";Super column Name:" + superColumnNameStr + ";condition:" + condition);
+ log.debug("rowKey: " + rowKey + "; Super column Name: " + superColumnNameStr + "; condition: " + condition);
// TODO: Second check unnecessary but unavoidable as filter clause
// property is incorrectly passed as column name
@@ -209,7 +208,6 @@ private void searchAndAddToResults(EntityMetadata m, String persistenceUnit, Con
}
}
-
}
}
2  kundera-cassandra/src/test/resources/META-INF/persistence.xml
View
@@ -13,7 +13,7 @@
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client" value="pelops" />
<property name="kundera.client.lookup.class"
- value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
+ value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="kundera.cache.provider.class"
value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
2  kundera-core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java
View
@@ -148,7 +148,7 @@ public Object recursivelyFindEntities(Object entity, Map<String, Object> relatio
*
* } else {
*/
- if (relation.isRelatedViaJoinTable())
+ if (relation.getType().equals(ForeignKey.MANY_TO_MANY))
{
// M-M relationship. Relationship entities are always
// fetched
10 kundera-core/src/main/java/com/impetus/kundera/persistence/AssociationBuilder.java
View
@@ -68,7 +68,13 @@ void populateRelationFromJoinTable(Object entity, EntityMetadata entityMetadata,
Relation relation)
{
- JoinTableMetadata jtMetadata = relation.getJoinTableMetadata();
+ JoinTableMetadata jtMetadata = relation.getJoinTableMetadata();
+ Client pClient = delegator.getClient(entityMetadata);
+ if(jtMetadata == null) {
+ EntityMetadata owningEntityMetadata = delegator.getMetadata(relation.getTargetEntity());
+ jtMetadata = owningEntityMetadata.getRelation(relation.getMappedBy()).getJoinTableMetadata();
+ pClient = delegator.getClient(owningEntityMetadata);
+ }
String joinTableName = jtMetadata.getJoinTableName();
Set<String> joinColumns = jtMetadata.getJoinColumns();
@@ -80,7 +86,7 @@ void populateRelationFromJoinTable(Object entity, EntityMetadata entityMetadata,
// EntityMetadata relMetadata =
// delegator.getMetadata(relation.getTargetEntity());
- Client pClient = delegator.getClient(entityMetadata);
+
Object entityId = PropertyAccessorHelper.getId(entity, entityMetadata);
List<?> foreignKeys = pClient.getColumnsById(entityMetadata.getSchema(), joinTableName, joinColumnName,
inverseJoinColumnName, entityId);
8 kundera-core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java
View
@@ -44,6 +44,7 @@
import com.impetus.kundera.client.ClientResolver;
import com.impetus.kundera.loader.ClientLifeCycleManager;
import com.impetus.kundera.metadata.KunderaMetadataManager;
+import com.impetus.kundera.metadata.model.KunderaMetadata;
import com.impetus.kundera.utils.InvalidConfigurationException;
/**
@@ -172,11 +173,8 @@ public final void close()
for (String pu : persistenceUnits)
{
- ((ClientLifeCycleManager) ClientResolver.getClientFactory(pu, /*
- * getExternalProperties
- * (
- * pu)
- */null)).destroy();
+ ((ClientLifeCycleManager) ClientResolver.getClientFactory(pu, getExternalProperties(pu))).destroy();
+ KunderaMetadata.INSTANCE.unloadKunderaMetadata(pu);
}
}
10 kundera-core/src/test/java/com/impetus/kundera/configure/AbstractPropertyReaderTest.java
View
@@ -79,13 +79,13 @@ public void testParseXML()
Assert.assertEquals(2, store.getSchemas().size());
Assert.assertEquals("HBASEUSERXYZ", store.getSchemas().get(0).getName());
Assert.assertNotNull(store.getSchemas().get(0).getTables());
- Assert.assertEquals(2, store.getSchemas().get(0).getTables().size());
- Assert.assertEquals("age", store.getSchemas().get(0).getTables().get(0).getName());
- Assert.assertEquals("address", store.getSchemas().get(0).getTables().get(1).getName());
+ Assert.assertEquals(1, store.getSchemas().get(0).getTables().size());
+ Assert.assertEquals("HBASEUSERXYZ", store.getSchemas().get(0).getTables().get(0).getName());
+
Assert.assertNotNull(store.getSchemas().get(0).getTables().get(0).getProperties());
- Assert.assertNotNull(store.getSchemas().get(0).getTables().get(1).getProperties());
+
Assert.assertEquals(5, store.getSchemas().get(0).getTables().get(0).getProperties().size());
- Assert.assertEquals(5, store.getSchemas().get(0).getTables().get(1).getProperties().size());
+
Assert.assertNull(store.getSchemas().get(0).getDataCenters());
Assert.assertNull(store.getSchemas().get(0).getSchemaProperties());
Assert.assertNotNull(store.getConnection());
41 kundera-hbase/src/main/java/com/impetus/client/hbase/HBaseClient.java
View
@@ -147,7 +147,7 @@ public Object find(Class entityClass, Object rowId)
}
catch (IOException e)
{
- log.error("Error during find by id, Caused by:" + e.getMessage());
+ log.error("Error during find by id, Caused by:" + e);
throw new KunderaException(e);
}
return enhancedEntity;
@@ -176,7 +176,7 @@ public Object find(Class entityClass, Object rowId)
if (rowKey != null)
{
List results = handler.readData(entityMetadata.getTableName(), entityMetadata.getEntityClazz(),
- entityMetadata, rowKey.toString(), entityMetadata.getRelationNames());
+ entityMetadata, rowKey, entityMetadata.getRelationNames());
if (results != null)
{
e = (E) results.get(0);
@@ -186,7 +186,7 @@ public Object find(Class entityClass, Object rowId)
}
catch (IOException ioex)
{
- log.error("Error during find All, Caused by:" + ioex.getMessage());
+ log.error("Error during find All, Caused by:" + ioex);
throw new KunderaException(ioex);
}
@@ -225,7 +225,7 @@ public Object find(Class entityClass, Object rowId)
}
catch (IOException ioex)
{
- log.error("Error during find for embedded entities, Caused by:" + ioex.getMessage());
+ log.error("Error during find for embedded entities, Caused by:" + ioex);
throw new KunderaException(ioex);
}
@@ -273,7 +273,7 @@ public Object find(Class entityClass, Object rowId)
}
catch (IOException ioex)
{
- log.error("Error during find All, Caused by:" + ioex.getMessage());
+ log.error("Error during find All, Caused by:" + ioex);
throw new KunderaException(ioex);
}
return results;
@@ -313,7 +313,7 @@ public Object find(Class entityClass, Object rowId)
}
catch (IOException ioex)
{
- log.error("Error during find All, Caused by:" + ioex.getMessage());
+ log.error("Error during find All, Caused by:" + ioex);
throw new KunderaException(ioex);
}
return results;
@@ -395,7 +395,7 @@ public void persistJoinTable(JoinTableData joinTableData)
{
try
{
- handler.createTableIfDoesNotExist(joinTableName, Constants.JOIN_COLUMNS_FAMILY_NAME);
+ handler.createTableIfDoesNotExist(joinTableName, joinTableName);
handler.writeJoinTableData(joinTableName, joinColumnValue, columns);
}
catch (IOException e)
@@ -434,7 +434,7 @@ public void deleteByColumn(String schemaName, String tableName, String columnNam
}
catch (IOException e)
{
- log.error("Error during delete by key. Caused by:" + e.getMessage());
+ log.error("Error during delete by key. Caused by:" + e);
throw new PersistenceException(e);
}
}
@@ -466,27 +466,32 @@ public void delete(Object entity, Object pKey)
EntityMetadata m = KunderaMetadataManager.getEntityMetadata(entityClazz);
+ String columnFamilyName = m.getTableName();
+
byte[] valueInBytes = HBaseUtils.getBytes(colValue);
- SingleColumnValueFilter f = new SingleColumnValueFilter(Bytes.toBytes(colName), Bytes.toBytes(colName),
- operator, valueInBytes);
+ SingleColumnValueFilter f = null;
+ f = new SingleColumnValueFilter(Bytes.toBytes(columnFamilyName), Bytes.toBytes(colName), operator, valueInBytes);
+
// f.setFilterIfMissing(true);
try
{
- return ((HBaseDataHandler) handler).scanData(f, m.getTableName(), entityClazz, m, colName);
+
+ return ((HBaseDataHandler) handler)
+ .scanData(f, m.getTableName(), entityClazz, m, columnFamilyName, colName);
}
catch (IOException ioe)
{
- log.error("Error during find By Relation, Caused by:" + ioe.getMessage());
+ log.error("Error during find By Relation, Caused by:", ioe);
throw new KunderaException(ioe);
}
catch (InstantiationException ie)
{
- log.error("Error during find By Relation, Caused by:" + ie.getMessage());
+ log.error("Error during find By Relation, Caused by:", ie);
throw new KunderaException(ie);
}
catch (IllegalAccessException iae)
{
- log.error("Error during find By Relation, Caused by:" + iae.getMessage());
+ log.error("Error during find By Relation, Caused by:", iae);
throw new KunderaException(iae);
}
}
@@ -527,18 +532,18 @@ public EntityReader getReader()
EntityMetadata m = KunderaMetadataManager.getEntityMetadata(entityClazz);
byte[] valueInBytes = HBaseUtils.getBytes(columnValue);
- Filter f = new SingleColumnValueFilter(Bytes.toBytes(columnName), Bytes.toBytes(columnName), operator,
+ Filter f = new SingleColumnValueFilter(Bytes.toBytes(tableName), Bytes.toBytes(columnName), operator,
valueInBytes);
KeyOnlyFilter keyFilter = new KeyOnlyFilter();
FilterList filterList = new FilterList(f, keyFilter);
try
{
- return handler.scanRowyKeys(filterList, tableName, Constants.JOIN_COLUMNS_FAMILY_NAME, columnName + "_"
+ return handler.scanRowyKeys(filterList, tableName, tableName, columnName + "_"
+ columnValue, m.getIdAttribute().getBindableJavaType());
}
catch (IOException e)
{
- log.error("Error while executing findIdsByColumn(), Caused by: " + e.getMessage());
+ log.error("Error while executing findIdsByColumn(), Caused by: " + e);
throw new KunderaException(e);
}
}
@@ -641,7 +646,7 @@ public int executeBatch()
}
catch (IOException e)
{
- log.error("Error while executing batch insert/update, Caused by: " + e.getMessage());
+ log.error("Error while executing batch insert/update, Caused by: " + e);
throw new KunderaException(e);
}
8 kundera-hbase/src/main/java/com/impetus/client/hbase/Reader.java
View
@@ -71,12 +71,13 @@
* the start row
* @param endRow
* the end row
- * @param columns
+ * @param columns
* @return the list
* @throws IOException
* Signals that an I/O exception has occurred.
*/
- List<HBaseData> loadAll(HTable hTable, Filter filter, byte[] startRow, byte[] endRow, String columnFamily, String[] columns) throws IOException;
+ List<HBaseData> loadAll(HTable hTable, Filter filter, byte[] startRow, byte[] endRow, String columnFamily,
+ String qualifier, String[] columns) throws IOException;
/**
* Scan row keys.
@@ -93,5 +94,6 @@
* @throws IOException
* Signals that an I/O exception has occurred.
*/
- Object[] scanRowKeys(final HTable hTable, final Filter filter, final String columnFamilyName, final String columnName, final Class rowKeyClazz) throws IOException;
+ Object[] scanRowKeys(final HTable hTable, final Filter filter, final String columnFamilyName,
+ final String columnName, final Class rowKeyClazz) throws IOException;
}
34 kundera-hbase/src/main/java/com/impetus/client/hbase/admin/HBaseDataHandler.java
View
@@ -247,7 +247,8 @@ public List readDataByRange(String tableName, Class clazz, EntityMetadata m, byt
List<String> relationNames = m.getRelationNames();
// Load raw data from HBase
hTable = gethTable(tableName);
- List<HBaseData> results = hbaseReader.loadAll(hTable, this.filter, startRow, endRow, m.getTableName(), columns);
+ List<HBaseData> results = hbaseReader.loadAll(hTable, this.filter, startRow, endRow, m.getTableName(), null,
+ columns);
output = onRead(tableName, clazz, m, output, hTable, entity, relationNames, results);
return output;
@@ -342,7 +343,7 @@ public void writeJoinTableData(String tableName, Object rowId, Map<String, Objec
{
hTable = gethTable(joinTableName);
- List<HBaseData> results = hbaseReader.LoadData(hTable, Constants.JOIN_COLUMNS_FAMILY_NAME, rowKey, filter);
+ List<HBaseData> results = hbaseReader.LoadData(hTable, joinTableName, rowKey, filter);
// assuming rowKey is not null.
if (results != null)
@@ -358,7 +359,7 @@ public void writeJoinTableData(String tableName, Object rowId, Map<String, Objec
String hbaseColumn = Bytes.toString(colData.getQualifier());
String hbaseColumnFamily = Bytes.toString(colData.getFamily());
- if (hbaseColumnFamily.equals(Constants.JOIN_COLUMNS_FAMILY_NAME)
+ if (hbaseColumnFamily.equals(joinTableName)
&& hbaseColumn.startsWith(inverseJoinColumnName))
{
byte[] val = colData.getValue();
@@ -572,15 +573,15 @@ private Object populateEntityFromHbaseData(Object entity, HBaseData hbaseData, E
{
String cfInHbase = Bytes.toString(colData.getFamily());
- if (!cfInHbase.equals(key))
+ // if (!cfInHbase.equals(key))
+ // {
+ if (relationNames != null && relationNames.contains(cfInHbase))
{
- if (relationNames != null && relationNames.contains(cfInHbase))
- {
- relations.put(cfInHbase,
- getObjectFromByteArray(entityType, colData.getValue(), cfInHbase, m));
- }
- continue;
+ relations.put(cfInHbase,
+ getObjectFromByteArray(entityType, colData.getValue(), cfInHbase, m));
}
+ // continue;
+ // }
// Set Hbase data into the column family object
String colName = Bytes.toString(colData.getQualifier());
@@ -856,8 +857,8 @@ public void addColumn(Attribute column)
}
}
- public List scanData(Filter f, final String tableName, Class clazz, EntityMetadata m, String qualifier)
- throws IOException, InstantiationException, IllegalAccessException
+ public List scanData(Filter f, final String tableName, Class clazz, EntityMetadata m, String columnFamily,
+ String qualifier) throws IOException, InstantiationException, IllegalAccessException
{
List returnedResults = new ArrayList();
@@ -865,7 +866,7 @@ public List scanData(Filter f, final String tableName, Class clazz, EntityMetada
m.getPersistenceUnit());
EntityType entityType = metaModel.entity(m.getEntityClazz());
Set<Attribute> attributes = entityType.getAttributes();
- String[] columns = new String[attributes.size()];
+ String[] columns = new String[attributes.size()-1];
int count = 0;
boolean isCollection = false;
for (Attribute attr : attributes)
@@ -880,8 +881,8 @@ else if (attr.isCollection())
break;
}
}
- List<HBaseData> results = hbaseReader.loadAll(gethTable(tableName), f, null, null, isCollection ? qualifier
- : null, !isCollection ? columns : null);
+ List<HBaseData> results = hbaseReader.loadAll(gethTable(tableName), f, null, null, m.getTableName(),
+ isCollection ? qualifier : null, /*!isCollection ? columns :*/ null);
if (results != null)
{
for (HBaseData row : results)
@@ -1016,8 +1017,7 @@ public void preparePersistentData(String tableName, Object entity, Object rowId,
// entity
if (columnFamilyField.isAnnotationPresent(Embedded.class))
{
- persistentData.add(new HBaseDataWrapper(rowId, columns, columnFamilyObject,
- columnFamilyName));
+ persistentData.add(new HBaseDataWrapper(rowId, columns, columnFamilyObject, tableName));
}
else
{
15 kundera-hbase/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
View
@@ -20,6 +20,8 @@
import java.util.Map;
import java.util.Properties;
+import javax.persistence.Embeddable;
+
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
@@ -127,6 +129,8 @@ protected void update(List<TableInfo> tableInfos)
}
if (tableInfo.getEmbeddedColumnMetadatas() != null)
{
+ // DO nothing as columns Embeddable entity would go into owners column family.
+ /*
for (EmbeddedColumnInfo embeddedColumnInfo : tableInfo.getEmbeddedColumnMetadatas())
{
boolean found = false;
@@ -146,7 +150,7 @@ protected void update(List<TableInfo> tableInfos)
admin.addColumn(tableInfo.getTableName(), columnDescriptor);
}
}
- }
+ */}
}
}
catch (IOException e)
@@ -200,7 +204,8 @@ protected void validate(List<TableInfo> tableInfos)
}
if (tableInfo.getEmbeddedColumnMetadatas() != null)
{
- for (EmbeddedColumnInfo embeddedColumnInfo : tableInfo.getEmbeddedColumnMetadatas())
+// DO nothing as columns Embeddable entity would go into owners column family.
+ /* for (EmbeddedColumnInfo embeddedColumnInfo : tableInfo.getEmbeddedColumnMetadatas())
{
boolean isColumnFound = false;
for (HColumnDescriptor columnDescriptor : hTableDescriptor.getColumnFamilies())
@@ -219,7 +224,7 @@ protected void validate(List<TableInfo> tableInfos)
tableInfo.getTableName(), tableInfo.getTableName());
}
}
- }
+ */}
}
catch (TableNotFoundException tnfex)
{
@@ -394,13 +399,15 @@ private HTableDescriptor getTableMetaData(TableInfo tableInfo)
}
if (tableInfo.getEmbeddedColumnMetadatas() != null)
{
+ // DO nothing as columns Embeddable entity would go into owners column family.
+ /*
for (EmbeddedColumnInfo embeddedColumnInfo : tableInfo.getEmbeddedColumnMetadatas())
{
HColumnDescriptor hColumnDescriptor = new HColumnDescriptor(embeddedColumnInfo.getEmbeddedColumnName());
setColumnFamilyProperties(hColumnDescriptor, tableInfo.getTableName());
tableDescriptor.addFamily(hColumnDescriptor);
}
- }
+ */}
if (tableProperties != null)
{
for (Object o : tableProperties.keySet())
19 kundera-hbase/src/main/java/com/impetus/client/hbase/service/HBaseReader.java
View
@@ -26,6 +26,7 @@
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.QualifierFilter;
import org.apache.hadoop.hbase.util.Bytes;
import com.impetus.client.hbase.HBaseData;
@@ -70,7 +71,7 @@
{
scan = new Scan();
}
- setScanCriteria(filter, columnFamily, scan, null);
+ setScanCriteria(filter, columnFamily, null, scan, null);
scanner = hTable.getScanner(scan);
return scanResults(columnFamily, results, scanner);
@@ -98,7 +99,7 @@
*/
@Override
public List<HBaseData> loadAll(HTable hTable, Filter filter, byte[] startRow, byte[] endRow, String columnFamily,
- String[] columns) throws IOException
+ String qualifier, String[] columns) throws IOException
{
List<HBaseData> results = null;
Scan s = null;
@@ -120,7 +121,7 @@ else if (endRow != null)
s = new Scan();
}
- setScanCriteria(filter, columnFamily, s, columns);
+ setScanCriteria(filter, columnFamily, qualifier, s, columns);
ResultScanner scanner = hTable.getScanner(s);
return scanResults(null, results, scanner);
@@ -131,7 +132,7 @@ else if (endRow != null)
* @param columnFamily
* @param s
*/
- private void setScanCriteria(Filter filter, String columnFamily, Scan s, String[] columns)
+ private void setScanCriteria(Filter filter, String columnFamily, String qualifier, Scan s, String[] columns)
{
if (filter != null)
{
@@ -139,7 +140,11 @@ private void setScanCriteria(Filter filter, String columnFamily, Scan s, String[
}
if (columnFamily != null)
{
- s.addFamily(Bytes.toBytes(columnFamily));
+// s.addFamily(Bytes.toBytes(columnFamily));
+ }
+ if (columnFamily != null && qualifier != null)
+ {
+ s.addColumn(Bytes.toBytes(columnFamily), Bytes.toBytes(qualifier));
}
if (columns != null && columns.length > 0)
{
@@ -189,7 +194,7 @@ private void setScanCriteria(Filter filter, String columnFamily, Scan s, String[
@Override
public Object[] scanRowKeys(final HTable hTable, final Filter filter, final String columnFamilyName,
- final String columnName,final Class rowKeyClazz) throws IOException
+ final String columnName, final Class rowKeyClazz) throws IOException
{
List<Object> rowKeys = new ArrayList<Object>();
Scan s = new Scan();
@@ -200,7 +205,7 @@ private void setScanCriteria(Filter filter, String columnFamily, Scan s, String[
for (Result result : scanner)
{
-
+
for (KeyValue keyValue : result.list())
{
rowKeys.add(HBaseUtils.fromBytes(keyValue.getRow(), rowKeyClazz));
6 kundera-hbase/src/main/java/com/impetus/client/hbase/service/HBaseWriter.java
View
@@ -145,7 +145,7 @@ public void writeColumns(HTable htable, Object rowKey, Map<String, Object> colum
boolean isPresent = false;
for (String columnName : columns.keySet())
{
- p.add(Bytes.toBytes(Constants.JOIN_COLUMNS_FAMILY_NAME), Bytes.toBytes(columnName),
+ p.add(htable.getTableName(), Bytes.toBytes(columnName),
HBaseUtils.getBytes(columns.get(columnName)));
isPresent = true;
// /* .getBytes() */);
@@ -183,8 +183,8 @@ public void writeRelations(HTable htable, Object rowKey, boolean containsEmbedde
}
else
{
- p.add(Bytes.toBytes(r.getRelationName()), Bytes.toBytes(r.getRelationName()),
- System.currentTimeMillis(), PropertyAccessorHelper.getBytes(r.getRelationValue()));
+ p.add(htable.getTableName(), Bytes.toBytes(r.getRelationName()), System.currentTimeMillis(),
+ PropertyAccessorHelper.getBytes(r.getRelationValue()));
// p.add(Bytes.toBytes(r.getRelationName()),
// System.currentTimeMillis(),
// Bytes.toBytes(r.getRelationValue()));
5 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/HBaseIdQueryTest.java
View
@@ -424,9 +424,8 @@ private void findByIdLTEAndAge()
private void init()
{
- cli.createTable("PERSON");
- cli.addColumnFamily("PERSON", "PERSON_NAME");
- cli.addColumnFamily("PERSON", "AGE");
+// cli.createTable("PERSON");
+// cli.addColumnFamily("PERSON", "PERSON");
Object p1 = prepareHbaseInstance("1", 10);
Object p2 = prepareHbaseInstance("2", 20);
Object p3 = prepareHbaseInstance("3", 15);
2  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/PersonHBase.java
View
@@ -25,7 +25,7 @@
* The Class Person.
*/
@Entity
-@Table(name = "PERSON", schema = "KunderaExamples@hbaseTest")
+@Table(name = "PERSON_HBASE", schema = "KunderaExamples@hbaseTest")
public class PersonHBase
{
5 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/PersonHBaseTest.java
View
@@ -88,9 +88,8 @@ private void init()
{
cli.startCluster();
}
- cli.createTable("PERSON");
- cli.addColumnFamily("PERSON", "PERSON_NAME");
- cli.addColumnFamily("PERSON", "AGE");
+// cli.createTable("PERSON");
+// cli.addColumnFamily("PERSON", "PERSON");
Object p1 = prepareHbaseInstance("1", 10);
Object p2 = prepareHbaseInstance("2", 20);
Object p3 = prepareHbaseInstance("3", 15);
4 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBigDecimalTest.java
View
@@ -52,7 +52,6 @@ public void tearDown() throws Exception
stopCluster();
}
}
-
@Test
public void testExecuteUseSameEm()
@@ -562,8 +561,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBigIntegerTest.java
View
@@ -564,8 +564,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
16 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseBooleanTest.java
View
@@ -27,6 +27,7 @@
private static final String table = "StudentHBaseBoolean";
private HBaseCli cli;
+
@Before
public void setUp() throws Exception
{
@@ -200,13 +201,11 @@ private void findByRange()
int count = 0;
for (StudentHBaseBoolean student : students)
{/*
- if (student.getId().equals(getMaxValue(Boolean.class)))
- {
- Assert.assertEquals(getMaxValue(short.class), student.getAge());
- Assert.assertEquals("Kuldeep", student.getName());
- count++;
- }
- else */if (student.getId().equals(getMinValue(Boolean.class)))
+ * if (student.getId().equals(getMaxValue(Boolean.class))) {
+ * Assert.assertEquals(getMaxValue(short.class), student.getAge());
+ * Assert.assertEquals("Kuldeep", student.getName()); count++; } else
+ */
+ if (student.getId().equals(getMinValue(Boolean.class)))
{
Assert.assertEquals(getPartialValue(short.class), student.getAge());
Assert.assertEquals(getMinValue(String.class), student.getName());
@@ -543,8 +542,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseByteTest.java
View
@@ -568,8 +568,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCalendarTest.java
View
@@ -504,8 +504,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCharTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseCharacterTest.java
View
@@ -572,8 +572,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseDateTest.java
View
@@ -571,8 +571,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseDoubleTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseFloatTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseIntTest.java
View
@@ -588,8 +588,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseIntegerTest.java
View
@@ -568,8 +568,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseLongTest.java
View
@@ -570,8 +570,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseShortTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseSqlDateTest.java
View
@@ -570,8 +570,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseStringTest.java
View
@@ -559,8 +559,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
5 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseTimeTest.java
View
@@ -570,9 +570,8 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
- }
+
+ }
public void dropSchema()
{
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseTimestampTest.java
View
@@ -570,8 +570,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
10 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseUUIDTest.java
View
@@ -22,6 +22,7 @@
private static final String table = "StudentHBaseUUID";
private HBaseCli cli;
+
private static final String keyspace = "KunderaHbaseDataType";
private EntityManagerFactory emf;
@@ -166,7 +167,7 @@ public void testFindByQuery(boolean useSameEm)
findByNameAndAgeWithOrClause();
findByAgeAndNameGTAndLT();
findByNameAndAGEBetween();
-// findByRange();
+ // findByRange();
}
private void findByAgeAndNameGTAndLT()
@@ -370,8 +371,8 @@ private void findByNameAndAGEBetween()
List<StudentHBaseUUID> students;
int count;
em = emf.createEntityManager();
- query = "Select s From StudentHBaseUUID s where s.name = Amresh and s.age between " + getPartialValue(short.class)
- + " and " + getMaxValue(short.class);
+ query = "Select s From StudentHBaseUUID s where s.name = Amresh and s.age between "
+ + getPartialValue(short.class) + " and " + getMaxValue(short.class);
q = em.createQuery(query);
students = q.getResultList();
Assert.assertNotNull(students);
@@ -569,8 +570,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasebooleanTest.java
View
@@ -542,8 +542,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
21 kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasebyteTest.java
View
@@ -22,7 +22,7 @@
private static final String keyspace = "KunderaHbaseDataType";
private EntityManagerFactory emf;
-
+
private static final String table = "StudentHBasebyte";
private HBaseCli cli;
@@ -220,12 +220,15 @@ private void findByRange()
Assert.assertEquals("Kuldeep", student.getName());
count++;
}
-// else if (student.getId() == ((Byte) getMinValue(byte.class)).byteValue())
-// {
-// Assert.assertEquals(getPartialValue(short.class), student.getAge());
-// Assert.assertEquals(getMinValue(String.class), student.getName());
-// count++;
-// }
+ // else if (student.getId() == ((Byte)
+ // getMinValue(byte.class)).byteValue())
+ // {
+ // Assert.assertEquals(getPartialValue(short.class),
+ // student.getAge());
+ // Assert.assertEquals(getMinValue(String.class),
+ // student.getName());
+ // count++;
+ // }
else
{
Assert.assertEquals(getRandomValue(byte.class), student.getId());
@@ -569,8 +572,8 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasedoubleTest.java
View
@@ -568,8 +568,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBasefloatTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaselongTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHBaseshortTest.java
View
@@ -567,8 +567,7 @@ public void stopCluster()
public void createSchema()
{
cli.createTable(table);
- cli.addColumnFamily(table, "NAME");
- cli.addColumnFamily(table, "AGE");
+
}
public void dropSchema()
3  kundera-hbase/src/test/java/com/impetus/client/hbase/crud/datatypes/StudentHbaseTest.java
View
@@ -489,7 +489,8 @@ void createSchema()
"ROLL_NUMBER".getBytes(), "MONTHLY_FEE".getBytes(), "SQL_DATE".getBytes(), "SQL_TIMESTAMP".getBytes(),
"SQL_TIME".getBytes(), "SQL_TIMESTAMP".getBytes(), "SQL_TIME".getBytes(), "BIG_INT".getBytes(),
"BIG_DECIMAL".getBytes(), "CALENDAR".getBytes() };
- cli.createTable("STUDENT".getBytes(), families);
+// cli.createTable("STUDENT".getBytes(), families);
+ cli.createTable("STUDENT");
// cli.addColumnFamily("STUDENT", "UNIQUE_ID");
// cli.addColumnFamily("STUDENT", "STUDENT_NAME");
// cli.addColumnFamily("STUDENT", "IS_EXCEPTIONAL");
10 kundera-hbase/src/test/java/com/impetus/client/hbase/junits/HBaseCli.java
View
@@ -145,7 +145,7 @@ public void createTable(byte[] tableName, byte[][] families)
}
catch (IOException e)
{
-
+
}
}
@@ -164,15 +164,19 @@ public void addColumnFamily(String tableName, String columnFamily)
utility.getHBaseAdmin().disableTable(tableName);
utility.getHBaseAdmin().addColumn(tableName, new HColumnDescriptor(columnFamily));
utility.getHBaseAdmin().enableTable(tableName);
+ while (utility.getHBaseAdmin().isTableEnabled(columnFamily))
+ {
+ return;
+ }
}
catch (InvalidFamilyOperationException ife)
{
- logger.info("Column family:" + columnFamily + " already exist!");
+ logger.info("Column family:" + columnFamily + " already exist!", ife);
}
catch (IOException e)
{
- logger.error(e.getMessage());
+ logger.error("", e);
}
}
31 kundera-hbase/src/test/java/com/impetus/client/twitter/TwibaseTest.java
View
@@ -29,11 +29,10 @@
HBaseCli cli = new HBaseCli();
-
@Override
protected void setUp() throws Exception
{
-// setUpInternal("hbaseTest");
+ setUpInternal("hbaseTest");
}
/**
@@ -42,13 +41,13 @@ protected void setUp() throws Exception
@Test
public void testOnExecute()
{
-// executeTestSuite();
+ executeTestSuite();
}
@Override
protected void tearDown() throws Exception
{
-// tearDownInternal();
+ tearDownInternal();
}
@Override
@@ -74,20 +73,20 @@ void createSchema()
{
if (AUTO_MANAGE_SCHEMA)
{
- cli.createTable("USER");
- cli.addColumnFamily("USER", "PREFERENCE_ID");
- cli.addColumnFamily("USER", "FRIEND_ID");
- cli.addColumnFamily("USER", "FOLLOWER_ID");
- cli.addColumnFamily("USER", "personalDetail");
+ // cli.createTable("USER");
+ // cli.addColumnFamily("USER", "PREFERENCE_ID");
+ // cli.addColumnFamily("USER", "FRIEND_ID");
+ // cli.addColumnFamily("USER", "FOLLOWER_ID");
+ // cli.addColumnFamily("USER", "personalDetail");
- cli.createTable("PREFERENCE");
- cli.addColumnFamily("PREFERENCE", "WEBSITE_THEME");
- cli.addColumnFamily("PREFERENCE", "PRIVACY_LEVEL");
+ // cli.createTable("PREFERENCE");
+ // cli.addColumnFamily("PREFERENCE", "WEBSITE_THEME");
+ // cli.addColumnFamily("PREFERENCE", "PRIVACY_LEVEL");
- cli.createTable("EXTERNAL_LINK");
- cli.addColumnFamily("EXTERNAL_LINK", "LINK_TYPE");
- cli.addColumnFamily("EXTERNAL_LINK", "USER_ID");
- cli.addColumnFamily("EXTERNAL_LINK", "LINK_ADDRESS");
+ // cli.createTable("EXTERNAL_LINK");
+ // cli.addColumnFamily("EXTERNAL_LINK", "LINK_TYPE");
+ // cli.addColumnFamily("EXTERNAL_LINK", "USER_ID");
+ // cli.addColumnFamily("EXTERNAL_LINK", "LINK_ADDRESS");
}
}
4 kundera-hbase/src/test/java/com/impetus/client/twitter/TwitterTestBaseHbase.java
View
@@ -37,9 +37,9 @@
*/
public abstract class TwitterTestBaseHbase extends TestCase
{
- public static final boolean RUN_IN_EMBEDDED_MODE = false;
+ public static final boolean RUN_IN_EMBEDDED_MODE = true;
- public static final boolean AUTO_MANAGE_SCHEMA = false;
+ public static final boolean AUTO_MANAGE_SCHEMA = true;
/** The user id1. */
String userId1;
2  kundera-hbase/src/test/java/com/impetus/client/twitter/entities/UserHBase.java
View
@@ -38,7 +38,7 @@
*
*/
@Entity
-@Table(name = "USER", schema = "KunderaExamples@hbaseTest")
+@Table(name = "USER_HBASE", schema = "KunderaExamples@hbaseTest")
public class UserHBase
{
16 kundera-hbase/src/test/resources/META-INF/persistence.xml
View
@@ -19,7 +19,7 @@
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
<!-- <property name="index.home.dir" value="./lucene" /> -->
- <property name="kundera.ddl.auto.prepare" value="create"/>
+ <property name="kundera.ddl.auto.prepare" value="create" />
<property name="kundera.client.property" value="kunderaTest.xml" />
</properties>
</persistence-unit>
@@ -88,6 +88,20 @@
<property name="kundera.batch.size" value="5" />
</properties>
</persistence-unit>
+ <persistence-unit name="ilpMainSchema">
+ <provider>com.impetus.kundera.KunderaPersistence</provider>
+ <properties>
+ <property name="kundera.nodes" value="localhost" />
+ <property name="kundera.port" value="60000" />
+ <property name="kundera.keyspace" value="KunderaExamples" />
+ <property name="kundera.dialect" value="hbase" />
+ <property name="kundera.ddl.auto.prepare" value="create" />
+ <property name="kundera.client.lookup.class" value="com.impetus.client.hbase.HBaseClientFactory" />
+ <property name="kundera.cache.provider.class"
+ value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
+ <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
+ </properties>
+ </persistence-unit>
</persistence>
7 kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTMBiAssociationTest.java
View
@@ -46,7 +46,7 @@
public class MTMBiAssociationTest extends TwinAssociation
{
- public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra",/*"addHbase",*/ "addMongo", };
+ public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", /*"addHbase",*/ "addMongo" };
/**
* Inits the.
@@ -229,8 +229,11 @@ private void assertPerson1(PersonnelBiMToM person1)
Assert.assertEquals(2, addresses1.size());
HabitatBiMToM address11 = (HabitatBiMToM) addresses1.toArray()[0];
Assert.assertNotNull(address11);
+ Assert.assertNotNull(address11.getPeople());
+ Assert.assertFalse(address11.getPeople().isEmpty());
HabitatBiMToM address12 = (HabitatBiMToM) addresses1.toArray()[1];
- Assert.assertNotNull(address12);
+ Assert.assertNotNull(address12.getPeople());
+ Assert.assertFalse(address12.getPeople().isEmpty());
}
@Override
2  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTMUniAssociationTest.java
View
@@ -49,7 +49,7 @@
*/
public class MTMUniAssociationTest extends TwinAssociation
{
- public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", /*"addHbase",*/"addMongo" };
+ public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", /*"addHbase",*/ "addMongo" };
/**
* Inits the.
2  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/MTOBiAssociationTest.java
View
@@ -45,7 +45,7 @@
public class MTOBiAssociationTest extends TwinAssociation
{
- public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra",/*"addHbase",*/"addMongo" };
+ public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", /*"addHbase",*/ "addMongo" };
/**
* Inits the.
2  kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/OTOBiAssociationTest.java
View
@@ -43,7 +43,7 @@
public class OTOBiAssociationTest extends TwinAssociation
{
- public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra"/*,"addHbase"*/,"addMongo" };
+ public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra",/* "addHbase",*/ "addMongo" };
/**
* Inits the.
5 kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/useraddress/OTOUniAssociationTest.java
View
@@ -69,10 +69,7 @@
*
*/
// private static final String KEYSPACE = "KUNDERATESTS";
- public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", /*
- * "addHbase"
- * ,
- */"addMongo" };
+ public static final String[] ALL_PUs_UNDER_TEST = new String[] { "rdbms", "addCassandra", "addMongo"/*, "addHbase" */};
/**
* Inits the.
26 kundera-tests/src/test/resources/META-INF/persistence.xml
View
@@ -86,7 +86,7 @@
value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
<!-- <property name="index.home.dir" value="/home/impadmin/lucene" /> -->
- <!-- <property name="kundera.ddl.auto.prepare" value="create" /> -->
+ <property name="kundera.ddl.auto.prepare" value="create" />
</properties>
</persistence-unit>
@@ -112,7 +112,7 @@
<class>com.impetus.kundera.examples.crossdatastore.useraddress.entities.HabitatUni1To1FK</class>
<properties>
<property name="kundera.client.lookup.class" value="com.impetus.client.rdbms.RDBMSClientFactory" />
- <property name="current_session_context_class" value="thread" />
+ <property name="current_session_context_class" value="thread" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
@@ -122,7 +122,8 @@
<property name="hibernate.connection.pool_size" value="10" />
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
- <property name="connection.provider_class" value="org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl" />
+ <property name="connection.provider_class"
+ value="org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl" />
</properties>
</persistence-unit>
@@ -130,8 +131,8 @@
<persistence-unit name="picmysql">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
- <property name="kundera.client.lookup.class" value="com.impetus.client.rdbms.RDBMSClientFactory" />
- <property name="current_session_context_class" value="thread" />
+ <property name="kundera.client.lookup.class" value="com.impetus.client.rdbms.RDBMSClientFactory" />
+ <property name="current_session_context_class" value="thread" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
@@ -142,15 +143,12 @@
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
-<!-- <property name="hibernate.c3p0.min_size" value="5" />
- <property name="hibernate.c3p0.max_size" value="20" />
- <property name="hibernate.c3p0.timeout" value="1800" />
- <property name="hibernate.c3p0.max_statements" value="50" />
- <property name="hibernate.connection.provider_class"
- value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider" />
- <property name="hibernate.c3p0.idle_test_period" value="10" />
- <property name="hibernate.c3p0.acquire_increment" value="5" />
- --> <!-- <property name="index.home.dir" value="./lucene" /> -->
+ <!-- <property name="hibernate.c3p0.min_size" value="5" /> <property name="hibernate.c3p0.max_size"
+ value="20" /> <property name="hibernate.c3p0.timeout" value="1800" /> <property
+ name="hibernate.c3p0.max_statements" value="50" /> <property name="hibernate.connection.provider_class"
+ value="org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider"
+ /> <property name="hibernate.c3p0.idle_test_period" value="10" /> <property
+ name="hibernate.c3p0.acquire_increment" value="5" /> --> <!-- <property name="index.home.dir" value="./lucene" /> -->
</properties>
</persistence-unit>
<persistence-unit name="piccandra">
Please sign in to comment.
Something went wrong with that request. Please try again.