|
50 | 50 | *
|
51 | 51 | * @author Oliver Gierke
|
52 | 52 | * @author Christoph Strobl
|
| 53 | + * @author Viktor Khoroshko |
53 | 54 | */
|
54 | 55 | public class MongoDbFactoryParserIntegrationTests {
|
55 | 56 |
|
@@ -198,6 +199,50 @@ public void rejectsClientUriPlusDetailedConfiguration() {
|
198 | 199 | reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-and-details.xml"));
|
199 | 200 | }
|
200 | 201 |
|
| 202 | + /** |
| 203 | + * @see DATAMONGO-1293 |
| 204 | + */ |
| 205 | + @Test |
| 206 | + public void setsUpClientUriWithId() { |
| 207 | + reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-and-id.xml")); |
| 208 | + BeanDefinition definition = factory.getBeanDefinition("testMongo"); |
| 209 | + ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues(); |
| 210 | + |
| 211 | + assertThat(constructorArguments.getArgumentCount(), is(1)); |
| 212 | + ValueHolder argument = constructorArguments.getArgumentValue(0, MongoClientURI.class); |
| 213 | + assertThat(argument, is(notNullValue())); |
| 214 | + } |
| 215 | + |
| 216 | + /** |
| 217 | + * @see DATAMONGO-1293 |
| 218 | + */ |
| 219 | + @Test |
| 220 | + public void setsUpUriWithId() { |
| 221 | + reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-uri-and-id.xml")); |
| 222 | + BeanDefinition definition = factory.getBeanDefinition("testMongo"); |
| 223 | + ConstructorArgumentValues constructorArguments = definition.getConstructorArgumentValues(); |
| 224 | + |
| 225 | + assertThat(constructorArguments.getArgumentCount(), is(1)); |
| 226 | + ValueHolder argument = constructorArguments.getArgumentValue(0, MongoClientURI.class); |
| 227 | + assertThat(argument, is(notNullValue())); |
| 228 | + } |
| 229 | + |
| 230 | + /** |
| 231 | + * @see DATAMONGO-1293 |
| 232 | + */ |
| 233 | + @Test(expected = BeanDefinitionParsingException.class) |
| 234 | + public void rejectsClientUriPlusDetailedConfigurationAndWriteConcern() { |
| 235 | + reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-write-concern-and-details.xml")); |
| 236 | + } |
| 237 | + |
| 238 | + /** |
| 239 | + * @see DATAMONGO-1293 |
| 240 | + */ |
| 241 | + @Test(expected = BeanDefinitionParsingException.class) |
| 242 | + public void rejectsUriPlusDetailedConfigurationAndWriteConcern() { |
| 243 | + reader.loadBeanDefinitions(new ClassPathResource("namespace/mongo-client-uri-write-concern-and-details.xml")); |
| 244 | + } |
| 245 | + |
201 | 246 | private static void assertWriteConcern(ClassPathXmlApplicationContext ctx, WriteConcern expectedWriteConcern) {
|
202 | 247 |
|
203 | 248 | SimpleMongoDbFactory dbFactory = ctx.getBean("first", SimpleMongoDbFactory.class);
|
|
0 commit comments