This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Used to clean all the stored data up. The cleaning can be by droping the database and/or the schema. | |
* Each system implementation can so define its own way to delete all data inserted by the test suite. | |
* @param sessionFactory | |
*/ | |
void dropSchemaAndDatabase(SessionFactory sessionFactory); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void dropSchemaAndDatabase(SessionFactory sessionFactory) { | |
MongoDBDatastoreProvider provider = getProvider( sessionFactory ); | |
try{ | |
provider.getDatabase().dropDatabase(); | |
}catch(MongoException ex){ | |
throw log.unableToDropDatabase( ex ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DBCollection currentCollection = this.getCollection( key ); | |
DBCursor cursor = currentCollection.find().sort( new BasicDBObject( ID_FIELDNAME, -1 ) ).limit( 1 ); | |
if ( cursor.hasNext() ) { | |
DBObject maxObject = cursor.next(); | |
Object idField = maxObject.get( ID_FIELDNAME ); | |
if ( idField.getClass().equals( Integer.class ) || idField.getClass().equals( Long.class ) ) { | |
long maxId = (Long) idField; | |
value.initialize( maxId + increment ); | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private BasicDBObject prepareIdObject(EntityKey key) { | |
return this.prepareIdObject( key.getColumnNames(), key.getColumnValues() ); | |
} | |
private BasicDBObject prepareIdObject(AssociationKey key){ | |
return this.prepareIdObject( key.getColumnNames(), key.getColumnValues() ); | |
} | |
private BasicDBObject prepareIdObject(String[] columnNames, Object[] columnValues){ /*...*/ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Downloading: http://oss.sonatype.org/content/repositories/vaadin-snapshots/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml | |
Downloading: http://maven.vaadin.com/vaadin-addons/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml | |
Downloading: http://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml | |
Downloading: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml | |
Downloading: http://morphia.googlecode.com/svn/mavenrepo/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml | |
Downloaded: http://repository.jboss.org/nexus/content/groups/public-jboss/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml (2 KB at 2.6 KB/sec) | |
Downloaded: http://repository.jboss.org/nexus/content/groups/public/org/hibernate/ogm/hibernate-ogm-core/4.0.0-SNAPSHOT/maven-metadata.xml (2 KB at 1.0 KB/sec) | |
[WARNING] Could not transf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": ObjectId("5008344fe032962ec56633a8"), | |
"columns": { | |
"Cloud_id": "3ac745bc-1a2a-4f0b-9163-8dce4f339ba2" | |
}, | |
"rows": [{ | |
"table": "Cloud_SnowFlake", | |
"columns": { | |
"Cloud_id": "3ac745bc-1a2a-4f0b-9163-8dce4f339ba2", | |
"producedSnowFlakes_id": "8e29e25a-f1fa-4ab9-945f-417e6313cbf9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id": { | |
"bankAccounts_id": "0c9e943e-d77b-44db-b55f-7a8eef451d61" | |
}, | |
"rows": [{ | |
"table": "AccountOwner_BankAccount", | |
"columns": { | |
"owners_id": "05bf8eb9-a20b-459d-bc97-dd370ce36111", | |
"bankAccounts_id": "0c9e943e-d77b-44db-b55f-7a8eef451d61" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DB extractDatabase() { | |
Object dbNameObject = this.cfg.get( Environment.MONGODB_DATABASE ); | |
if ( dbNameObject == null ) { | |
throw log.mongoDbNameMissing(); | |
} | |
String dbName = (String) dbNameObject; | |
log.connectingToMongoDatabase( dbName ); | |
if ( !this.mongo.getDatabaseNames().contains( dbName ) ) { | |
log.creatingDatabase( dbName ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConnectionConfigurationTest extends OgmTestCase { | |
@Test | |
public void testConnectionTimeout() { | |
final long start = System.currentTimeMillis(); | |
SessionFactoryImplementor factory = super.sfi(); | |
ServiceRegistryImplementor serviceRegistry = factory.getServiceRegistry(); | |
MongoDBDatastoreProvider provider = (MongoDBDatastoreProvider) serviceRegistry.getService( DatastoreProvider.class ); | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void testConnectionTimeout() { | |
Map<String, Object> cfg = new HashMap<String, Object>(); | |
cfg.put( Environment.MONGODB_TIMEOUT, "50" ); | |
cfg.put( Environment.MONGODB_HOST, "203.0.113.1" ); | |
cfg.put( Environment.MONGODB_DATABASE, "ogm_test_database" ); | |
MongoDBDatastoreProvider provider = new MongoDBDatastoreProvider(); | |
provider.configure( cfg ); | |
final long start = System.nanoTime(); | |
try { |
OlderNewer