Code Clean Up
[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 static org.ops4j.pax.exam.CoreOptions.maven;
11 import javax.inject.Inject;
12 import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
15 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
16 import org.ops4j.pax.exam.options.MavenUrlReference;
17 import org.ops4j.pax.exam.util.Filter;
18 import org.osgi.framework.BundleContext;
19 import org.osgi.framework.ServiceReference;
20
21 public class AbstractPcepOsgiTest extends AbstractMdsalTestBase {
22
23     @Inject
24     @Filter(timeout = 60 * 1000)
25     BundleContext bundleContext;
26     BindingAwareBroker broker = null;
27
28     public BindingAwareBroker getBroker() {
29         if (this.broker == null) {
30             ServiceReference<BindingAwareBroker> serviceReference = this.bundleContext.getServiceReference(BindingAwareBroker.class);
31             if (serviceReference == null) {
32                 throw new RuntimeException("BindingAwareBroker not found");
33             }
34             this.broker = this.bundleContext.getService(serviceReference);
35         }
36         return this.broker;
37     }
38
39     @Override
40     public String getModuleName() {
41         return "pcep-topology-provider";
42     }
43
44     @Override
45     public String getInstanceName() {
46         return "pcep-topology";
47     }
48
49     @Override
50     public MavenUrlReference getFeatureRepo() {
51         return maven().groupId("org.opendaylight.bgpcep").artifactId("features-pcep")
52                 .classifier("features").type("xml").versionAsInProject();
53     }
54
55     @Override
56     public String getFeatureName() {
57         return "odl-bgpcep-pcep-all";
58     }
59
60     TopologyKey getTopologyId(final String id) {
61         return new TopologyKey(new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId(id));
62     }
63
64     abstract class AbstractTestProvider implements BindingAwareProvider {
65     }
66 }