/*
 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.protocol.integration.pcep;

import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.systemPackages;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;

import java.util.Collection;
import java.util.Collections;
import javax.inject.Inject;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
import org.opendaylight.controller.test.sal.binding.it.TestHelper;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yangtools.yang.binding.RpcService;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.options.DefaultCompositeOption;
import org.ops4j.pax.exam.util.Filter;
import org.osgi.framework.BundleContext;

//FIXME: merge with org.opendaylight.controller.test.sal.binding.it.AbstractTest ?
public class AbstractPcepOsgiTest {
    @Inject
    @Filter(timeout = 120 * 1000)
    BindingAwareBroker broker;
    @Inject
    BundleContext bundleContext;

    public BindingAwareBroker getBroker() {
        return this.broker;
    }

    public void setBroker(final BindingAwareBroker broker) {
        this.broker = broker;
    }

    public BundleContext getBundleContext() {
        return this.bundleContext;
    }

    public void setBundleContext(final BundleContext bundleContext) {
        this.bundleContext = bundleContext;
    }

    @Configuration
    public Option[] config() {
        return options(
                // TestHelper.getLoggingBundles(), //

                pcepModules(), //
                systemProperty("osgi.bundles.defaultStartLevel").value("4"),
                systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
                systemPackages("sun.nio.ch"),

                mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(), //
                mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(), //
                mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(), //
                mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),
                mavenBundle("org.openexi", "nagasena").versionAsInProject(),

                TestHelper.mdSalCoreBundles(),

                TestHelper.bindingAwareSalBundles(), TestHelper.configMinumumBundles(), TestHelper.baseModelBundles(),
                TestHelper.flowCapableModelBundles(), TestHelper.junitAndMockitoBundles());
    }

    private Option pcepModules() {
        return new DefaultCompositeOption(
                mavenBundle("org.opendaylight.yangtools.model", "ietf-topology").versionAsInProject(), //
                mavenBundle("org.opendaylight.yangtools", "object-cache-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-topology-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-tunnel-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-impl").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-spi").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-ietf-stateful02").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "pcep-ietf-stateful07").versionAsInProject(), //
                mavenBundle("org.opendaylight.tcpmd5", "tcpmd5-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.tcpmd5", "tcpmd5-netty").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "topology-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "topology-tunnel-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "programming-topology-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "programming-tunnel-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "concepts").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "util").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "rsvp-api").versionAsInProject(), //
                mavenBundle("org.opendaylight.bgpcep", "programming-api").versionAsInProject());
    }

    abstract class AbstractTestProvider implements BindingAwareProvider {

        @Override
        public Collection<? extends RpcService> getImplementations() {
            return Collections.emptySet();
        }

        @Override
        public Collection<? extends ProviderFunctionality> getFunctionality() {
            return Collections.emptySet();
        }

        @Override
        public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {
        }

    }

    TopologyKey getTopologyId(final String id) {
        return new TopologyKey(new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId(id));
    }
}

@@ -593,67 +593,8 @@
 y;%0A%0A
-import java.util.Collection;%0Aimport java.util.Collections;%0A
 impo
@@ -952,67 +952,8 @@
 ey;%0A
-import org.opendaylight.yangtools.yang.binding.RpcService;%0A
 impo
@@ -4869,425 +4869,8 @@
  %7B%0A%0A
-        @Override%0A        public Collection%3C? extends RpcService%3E getImplementations() %7B%0A            return Collections.emptySet();%0A        %7D%0A%0A        @Override%0A        public Collection%3C? extends ProviderFunctionality%3E getFunctionality() %7B%0A            return Collections.emptySet();%0A        %7D%0A%0A        @Override%0A        public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) %7B%0A        %7D%0A%0A
     

Remove deprecated BindingAwareProvider methods