Skip to content

Commit

Permalink
OGM-1246 Fix import orders, syntax erorrs and replaced classes with i…
Browse files Browse the repository at this point in the history
…nterfaces
  • Loading branch information
DavideD committed Aug 22, 2017
1 parent c93f680 commit 98544de
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
Expand Up @@ -6,6 +6,10 @@
*/
package org.hibernate.ogm.datastore.mongodb;

import static java.lang.Boolean.FALSE;
import static org.hibernate.ogm.datastore.document.impl.DotPatternMapHelpers.getColumnSharedPrefixOfAssociatedEntityLink;
import static org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoHelpers.hasField;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -20,6 +24,8 @@
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

import org.bson.Document;
import org.bson.types.ObjectId;
import org.hibernate.AssertionFailure;
import org.hibernate.ogm.datastore.document.association.impl.DocumentHelpers;
import org.hibernate.ogm.datastore.document.cfg.DocumentStoreProperties;
Expand Down Expand Up @@ -101,6 +107,10 @@
import org.hibernate.type.SerializableToBlobType;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.type.Type;
import org.parboiled.Parboiled;
import org.parboiled.errors.ErrorUtils;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParsingResult;

import com.mongodb.DuplicateKeyException;
import com.mongodb.MongoBulkWriteException;
Expand Down Expand Up @@ -128,16 +138,6 @@
import com.mongodb.client.model.UpdateOptions;
import com.mongodb.client.result.DeleteResult;
import com.mongodb.client.result.UpdateResult;
import org.bson.Document;
import org.bson.types.ObjectId;
import org.parboiled.Parboiled;
import org.parboiled.errors.ErrorUtils;
import org.parboiled.parserunners.RecoveringParseRunner;
import org.parboiled.support.ParsingResult;

import static java.lang.Boolean.FALSE;
import static org.hibernate.ogm.datastore.document.impl.DotPatternMapHelpers.getColumnSharedPrefixOfAssociatedEntityLink;
import static org.hibernate.ogm.datastore.mongodb.dialect.impl.MongoHelpers.hasField;

/**
* Each Tuple entry is stored as a property in a MongoDB document.
Expand Down Expand Up @@ -950,7 +950,7 @@ private static Document stage(String key, Object value) {
/**
* do 'Distinct' operation
*
* @param queryDescriptor descriptor of MongoDN query
* @param queryDescriptor descriptor of MongoDB query
* @param collection collection for execute the operation
* @return result iterator
* @see <a href ="https://docs.mongodb.com/manual/reference/method/db.collection.distinct/">distinct</a>
Expand Down Expand Up @@ -1038,7 +1038,7 @@ else if ( ( (Document) out ).containsKey( "reduce" ) ) {
}

MongoCursor<Document> cursor = mapReduceIterable.iterator();
LinkedHashMap<Object, Object> documents = new LinkedHashMap<>();
Map<Object, Object> documents = new LinkedHashMap<>();
while ( cursor.hasNext() ) {
Document doc = cursor.next();
documents.put( doc.get( "_id" ), doc.get( "value" ) );
Expand Down
Expand Up @@ -30,7 +30,6 @@ public class MongoDBQueryParsingResult implements QueryParsingResult {
private final Document orderBy;
private final List<String> unwinds;


public MongoDBQueryParsingResult(Class<?> entityType, String collectionName, Document query, Document projection, Document orderBy, List<String> unwinds) {
this.entityType = entityType;
this.collectionName = collectionName;
Expand Down
Expand Up @@ -143,7 +143,7 @@ public boolean setReduceFunction(String reduceFunction) {
}

public MongoDBQueryDescriptor build() {
//@todo redactor the spagetti!
//@todo refactor the spaghetti!
if ( operation != Operation.AGGREGATE_PIPELINE ) {
MongoDBQueryDescriptor descriptor = null;

Expand Down
Expand Up @@ -6,25 +6,24 @@
*/
package org.hibernate.ogm.datastore.mongodb.test.query.nativequery;

import static org.fest.assertions.Assertions.assertThat;

import java.util.LinkedHashMap;
import java.util.List;

import org.fest.assertions.Fail;
import org.fest.assertions.MapAssert;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.ogm.OgmSession;
import org.hibernate.ogm.utils.OgmTestCase;
import org.hibernate.ogm.utils.TestForIssue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.mongodb.BasicDBList;
import org.fest.assertions.Fail;
import org.fest.assertions.MapAssert;

import static org.fest.assertions.Assertions.assertThat;

/**
* Test the execution of native queries on MongoDB using the {@link Session}
Expand Down

0 comments on commit 98544de

Please sign in to comment.