DATADOC-83 - Review dependencies

This commit is contained in:
Mark Pollack
2011-05-24 00:55:30 -04:00
parent c8e16318e8
commit 3893eb126d
5 changed files with 9 additions and 14 deletions

View File

@@ -24,10 +24,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>

View File

@@ -28,7 +28,6 @@ import org.springframework.dao.DuplicateKeyException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.dao.InvalidDataAccessResourceUsageException;
import org.springframework.dao.support.PersistenceExceptionTranslator;
import org.springframework.data.document.UncategorizedDocumentStoreException;
/**
* Simple {@link PersistenceExceptionTranslator} for Mongo. Convert the given runtime exception to an appropriate
@@ -71,7 +70,7 @@ public class MongoExceptionTranslator implements PersistenceExceptionTranslator
} else if (code == 10003 || code == 12001 || code == 12010 || code == 12011 || code == 12012) {
throw new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
}
return new UncategorizedDocumentStoreException(ex.getMessage(), ex);
return new UncategorizedMongoDbException(ex.getMessage(), ex);
}
if (ex instanceof MongoInternalException) {
return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);

View File

@@ -23,7 +23,8 @@ import java.util.List;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import org.springframework.data.document.InvalidDocumentStoreApiUsageException;
import org.springframework.data.document.mongodb.InvalidMongoDbApiUsageException;
import org.springframework.data.document.mongodb.geo.Box;
import org.springframework.data.document.mongodb.geo.Circle;
import org.springframework.data.document.mongodb.geo.Point;
@@ -84,11 +85,11 @@ public class Criteria implements CriteriaDefinition {
*/
public Criteria is(Object o) {
if (isValue != NOT_SET) {
throw new InvalidDocumentStoreApiUsageException(
throw new InvalidMongoDbApiUsageException(
"Multiple 'is' values declared. You need to use 'and' with multiple criteria");
}
if (this.criteria.size() > 0 && "$not".equals(this.criteria.keySet().toArray()[this.criteria.size() - 1])) {
throw new InvalidDocumentStoreApiUsageException(
throw new InvalidMongoDbApiUsageException(
"Invalid query: 'not' can't be used with 'is' - use 'ne' instead.");
}
this.isValue = o;
@@ -159,7 +160,7 @@ public class Criteria implements CriteriaDefinition {
*/
public Criteria in(Object... o) {
if (o.length > 1 && o[1] instanceof Collection) {
throw new InvalidDocumentStoreApiUsageException("You can only pass in one argument of type "
throw new InvalidMongoDbApiUsageException("You can only pass in one argument of type "
+ o[1].getClass().getName());
}
criteria.put("$in", o);

View File

@@ -39,7 +39,6 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.document.InvalidDocumentStoreApiUsageException;
import org.springframework.data.document.mongodb.convert.MappingMongoConverter;
import org.springframework.data.document.mongodb.convert.MongoConverter;
import org.springframework.data.document.mongodb.mapping.MongoMappingContext;
@@ -368,7 +367,7 @@ public class MongoTemplateTests {
Query q3 = new Query(Criteria.where("age").in(l1, l2));
template.find(q3, PersonWithIdPropertyOfTypeObjectId.class);
Assert.fail("Should have trown an InvalidDocumentStoreApiUsageException");
} catch (InvalidDocumentStoreApiUsageException e) {
} catch (InvalidMongoDbApiUsageException e) {
}
}

View File

@@ -19,7 +19,7 @@ import static org.springframework.data.document.mongodb.query.Criteria.where;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.data.document.InvalidDocumentStoreApiUsageException;
import org.springframework.data.document.mongodb.InvalidMongoDbApiUsageException;
public class QueryTests {
@@ -42,7 +42,7 @@ public class QueryTests {
try {
new Query(where("name").not().is("Thomas"));
Assert.fail("This should have caused an InvalidDocumentStoreApiUsageException");
} catch (InvalidDocumentStoreApiUsageException e) {
} catch (InvalidMongoDbApiUsageException e) {
}
}