db111885a76bb8d5753821e7e5ca96e42cf7b43f
[ccsdk/cds.git] /
1 /*
2  *  Copyright © 2018 IBM.
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
17 package org.onap.ccsdk.apps.controllerblueprints.service.repository;
18
19 import org.junit.Assert;
20 import org.junit.FixMethodOrder;
21 import org.junit.Test;
22 import org.junit.runner.RunWith;
23 import org.junit.runners.MethodSorters;
24 import org.onap.ccsdk.apps.controllerblueprints.TestApplication;
25 import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;
26 import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
28 import org.springframework.test.context.ContextConfiguration;
29 import org.springframework.test.context.junit4.SpringRunner;
30
31 import java.util.Arrays;
32 import java.util.List;
33 /**
34  * ResourceDictionaryReactRepositoryTest.
35  *
36  * @author Brinda Santh
37  */
38
39 @RunWith(SpringRunner.class)
40 @DataJpaTest
41 @ContextConfiguration(classes = {TestApplication.class})
42 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
43 public class ResourceDictionaryReactRepositoryTest {
44
45     @Autowired
46     protected ResourceDictionaryReactRepository resourceDictionaryReactRepository;
47
48     @Test
49     public void test01FindByNameReact() throws Exception {
50         ResourceDictionary dbResourceDictionary = resourceDictionaryReactRepository.findByName("db-source").block();
51         Assert.assertNotNull("Failed to query React Resource Dictionary by Name", dbResourceDictionary);
52     }
53
54     @Test
55     public void test02FindByNameInReact() throws Exception {
56         List<ResourceDictionary> dbResourceDictionaries =
57                 resourceDictionaryReactRepository.findByNameIn(Arrays.asList("db-source")).collectList().block();
58         Assert.assertNotNull("Failed to query React Resource Dictionary by Names", dbResourceDictionaries);
59     }
60
61     @Test
62     public void test03FindByTagsContainingIgnoreCaseReact() throws Exception {
63         List<ResourceDictionary> dbTagsResourceDictionaries =
64                 resourceDictionaryReactRepository.findByTagsContainingIgnoreCase("db-source").collectList().block();
65         Assert.assertNotNull("Failed to query React Resource Dictionary by Tags", dbTagsResourceDictionaries);
66     }
67 }