Added routed rpcs to pcep-topology|tunnel-provider
[bgpcep.git] / integration-tests / src / test / java / org / opendaylight / protocol / integration / pcep / AbstractPcepOsgiTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.integration.pcep;
9
10 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
12 import org.opendaylight.protocol.integration.TestHelper;
13 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
14 import org.opendaylight.yangtools.yang.binding.RpcService;
15 import org.ops4j.pax.exam.Configuration;
16 import org.ops4j.pax.exam.Option;
17 import org.ops4j.pax.exam.options.DefaultCompositeOption;
18 import org.ops4j.pax.exam.util.Filter;
19 import org.osgi.framework.BundleContext;
20
21 import javax.inject.Inject;
22 import java.util.Collection;
23 import java.util.Collections;
24
25 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
26 import static org.ops4j.pax.exam.CoreOptions.options;
27 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
28
29 public class AbstractPcepOsgiTest {
30         @Inject
31         @Filter(timeout=60*1000)
32         BindingAwareBroker broker;
33         @Inject
34         BundleContext bundleContext;
35
36         public BindingAwareBroker getBroker() {
37                 return broker;
38         }
39
40         public void setBroker(BindingAwareBroker broker) {
41                 this.broker = broker;
42         }
43
44         public BundleContext getBundleContext() {
45                 return bundleContext;
46         }
47
48         public void setBundleContext(BundleContext bundleContext) {
49                 this.bundleContext = bundleContext;
50         }
51
52         @Configuration
53         public Option[] config() {
54                 return options(TestHelper.getLoggingBundles(), //
55
56                                 pcepModules(), //
57                                 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
58
59                                 TestHelper.mdSalCoreBundles(),
60
61                                 TestHelper.bindingAwareSalBundles(),
62                                 TestHelper.configMinumumBundles(),
63                                 TestHelper.baseModelBundles(),
64                                 TestHelper.flowCapableModelBundles(),
65                 TestHelper.junitAndMockitoBundles());
66         }
67
68         private Option pcepModules() {
69                 return new DefaultCompositeOption(mavenBundle("org.opendaylight.yangtools.model", "ietf-topology").versionAsInProject(), //
70                                 mavenBundle("org.opendaylight.bgpcep", "pcep-topology-api").versionAsInProject(), //
71                                 mavenBundle("org.opendaylight.bgpcep", "pcep-tunnel-api").versionAsInProject(), //
72                                 mavenBundle("org.opendaylight.bgpcep", "pcep-api").versionAsInProject(), //
73                                 mavenBundle("org.opendaylight.bgpcep", "topology-api").versionAsInProject(), //
74                                 mavenBundle("org.opendaylight.bgpcep", "topology-tunnel-api").versionAsInProject(), //
75                                 mavenBundle("org.opendaylight.bgpcep", "programming-topology-api").versionAsInProject(), //
76                                 mavenBundle("org.opendaylight.bgpcep", "programming-tunnel-api").versionAsInProject(), //
77                                 mavenBundle("org.opendaylight.bgpcep", "concepts").versionAsInProject(), //
78                                 mavenBundle("org.opendaylight.bgpcep", "util").versionAsInProject(), //
79                                 mavenBundle("org.opendaylight.bgpcep", "rsvp-api").versionAsInProject(), //
80                                 mavenBundle("org.opendaylight.bgpcep", "programming-api").versionAsInProject());
81         }
82
83         abstract class AbstractTestProvider implements BindingAwareProvider {
84
85                 @Override
86                 public Collection<? extends RpcService> getImplementations() {
87                         return Collections.emptySet();
88                 }
89
90                 @Override
91                 public Collection<? extends ProviderFunctionality> getFunctionality() {
92                         return Collections.emptySet();
93                 }
94
95                 @Override
96                 public void onSessionInitialized(BindingAwareBroker.ConsumerContext session) {}
97
98         }
99
100         TopologyKey getTopologyId(String id) {
101                 return new TopologyKey(new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId(id));
102         }
103 }