cc880d1adc12abeb67cd5a17c878f39493a03518
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.dataprovider.test;
23
24 import static org.junit.Assert.fail;
25
26 import java.util.Set;
27
28 import org.junit.Test;
29 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.AboutHttpServlet;
30 import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet;
31 import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataProviderImpl;
32 import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.StatusChangedHandler.StatusKey;
33 import org.opendaylight.mdsal.binding.api.RpcProviderService;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.DataProviderService;
35 import org.opendaylight.yangtools.concepts.ObjectRegistration;
36 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
37 import org.opendaylight.yangtools.yang.binding.RpcService;
38
39 import net.bytebuddy.implementation.bytecode.StackSize;
40
41 /**
42  * @author Michael Dürre
43  *
44  */
45 public class TestImplementation {
46
47     @Test
48     public void test() {
49         TestConfig.setSDNRDBURLEnv();
50         DataProviderImpl impl = new DataProviderImpl();
51         impl.setRpcProviderService(new RpcProviderService() {
52
53             @Override
54             public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
55                     T implementation, Set<InstanceIdentifier<?>> paths) {
56                 // TODO Auto-generated method stub
57                 return null;
58             }
59
60             @Override
61             public <S extends RpcService, T extends S> ObjectRegistration<T> registerRpcImplementation(Class<S> type,
62                     T implementation) {
63                 // TODO Auto-generated method stub
64                 return null;
65             }
66         });
67         impl.setMediatorServerServlet(new MsServlet());
68         impl.setAboutServlet(new AboutHttpServlet());
69         try {
70             impl.init();
71         } catch (Exception e) {
72             e.printStackTrace();
73             fail("failed to init impl: " + e.getMessage());
74         }
75
76         impl.setStatus(StatusKey.CLUSTER_SIZE, "3");
77         impl.setReadyStatus(true);
78         try {
79             impl.close();
80         } catch (Exception e) {
81             e.printStackTrace();
82             fail("failed to close impl: " + e.getMessage());
83         }
84     }
85
86 }