final String named_query2 = "Select t2 from TestEntity t2 where t2.field = :field";
final String native_query = "Select native from TestEntity native where native.field = :field";
final String native_query1 = "Select native1 from TestEntity native1 where native1.field = :field";
final String native_query2 = "Select native2 from TestEntity native2 where native2.field = :field";
EntityMetadata metadata = new EntityMetadata(EntitySample.class);
metadata.setPersistenceUnit("rdbms");
PersistenceUnitMetadata puMetadata = new PersistenceUnitMetadata();
puMetadata.setPersistenceUnitName(persistenceUnit);
Map<String, Object> props = new HashMap<String, Object>();
props.put(Constants.PERSISTENCE_UNIT_NAME, persistenceUnit);
props.put(PersistenceProperties.KUNDERA_NODES, "localhost");
props.put(PersistenceProperties.KUNDERA_PORT, "9160");
props.put(PersistenceProperties.KUNDERA_KEYSPACE, "KunderaHbaseExamples");
props.put(PersistenceProperties.KUNDERA_CLIENT_FACTORY, "com.impetus.client.CoreTestClientFactory");
Properties p = new Properties();
p.putAll(props);
puMetadata.setProperties(p);
ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata();
Map<String, PersistenceUnitMetadata> metadataCol = new HashMap<String, PersistenceUnitMetadata>();
metadataCol.put(persistenceUnit, puMetadata);
appMetadata.addPersistenceUnitMetadata(metadataCol);
MetadataBuilder metadataBuilder = new MetadataBuilder(persistenceUnit, CoreTestClient.class.getSimpleName(),
null, kunderaMetadata);
metadataBuilder.buildEntityMetadata(metadata.getEntityClazz());
// Named query asserts.
Assert.assertNotNull(appMetadata.getQuery("test.named.query"));
Assert.assertEquals(appMetadata.getQuery("test.named.query"), named_query);
Assert.assertNotNull(appMetadata.getQuery("test.named.queries1"));