|
| 1 | +/** |
| 2 | + * Copyright © 2018 spring-data-dynamodb (https://github.com/boostchicken/spring-data-dynamodb) |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.socialsignin.spring.data.dynamodb.repository.config; |
| 17 | + |
| 18 | +import org.junit.Test; |
| 19 | +import org.junit.runner.RunWith; |
| 20 | +import org.socialsignin.spring.data.dynamodb.domain.sample.NestedRepostioryDocument; |
| 21 | +import org.socialsignin.spring.data.dynamodb.utils.DynamoDBLocalResource; |
| 22 | +import org.springframework.beans.factory.annotation.Autowired; |
| 23 | +import org.springframework.context.annotation.Configuration; |
| 24 | +import org.springframework.test.context.ContextConfiguration; |
| 25 | +import org.springframework.test.context.TestPropertySource; |
| 26 | +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| 27 | + |
| 28 | +import java.util.Optional; |
| 29 | + |
| 30 | +import static org.junit.Assert.assertEquals; |
| 31 | + |
| 32 | +@RunWith(SpringJUnit4ClassRunner.class) |
| 33 | +@ContextConfiguration(classes = {DynamoDBLocalResource.class, ConsiderNestingRepositoriesTest.TestAppConfig.class}) |
| 34 | +@TestPropertySource(properties = {"spring.data.dynamodb.entity2ddl.auto=create"}) |
| 35 | +public class ConsiderNestingRepositoriesTest { |
| 36 | + |
| 37 | + @Configuration |
| 38 | + @EnableDynamoDBRepositories(basePackages = "org.socialsignin.spring.data.dynamodb.domain.sample", considerNestedRepositories = true) |
| 39 | + public static class TestAppConfig { |
| 40 | + } |
| 41 | + |
| 42 | + @Autowired |
| 43 | + private NestedRepostioryDocument.Repository repostitory; |
| 44 | + |
| 45 | + @Test |
| 46 | + public void testNestedRepositoriesAreSupported() { |
| 47 | + // make any call to the repository to make sure it is working |
| 48 | + assertEquals(repostitory.findById("someId"), Optional.empty()); |
| 49 | + } |
| 50 | +} |
0 commit comments