<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-parent</artifactId>
+ <artifactId>mdsal-it-parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<artifactId>sal-binding-it</artifactId>
<dependencies>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>org.eclipse.persistence.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.eclipse.persistence</groupId>
- <artifactId>org.eclipse.persistence.moxy</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>object-cache-guava</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager-facade-xml</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-file-xml-adapter</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-persister-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>logback-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-broker-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-broker-config</artifactId>
- </dependency>
- <dependency>
- <!-- TODO Add this to odlparent -->
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-runtime</artifactId>
- <version>4.5.1-1</version>
- </dependency>
-
- <!--Compile scopes for all testing dependencies are intentional-->
- <!--This way, all testing dependencies can be transitively used by other integration test modules-->
- <!--If the dependencies are test scoped, they are not visible to other maven modules depending on sal-binding-it-->
-
- <!--TODO Create generic utilities(extract from this module) for integration tests on the controller-->
- <dependency>
- <groupId>openexi</groupId>
- <artifactId>nagasena</artifactId>
- </dependency>
- <dependency>
- <groupId>openexi</groupId>
- <artifactId>nagasena-rta</artifactId>
+ <artifactId>sal-test-model</artifactId>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
tests. -->
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-native</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>log4j-over-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-test-model</artifactId>
- <version>${mdsal.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>opendaylight-l2-types</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.inject</groupId>
- <artifactId>javax.inject</artifactId>
- <version>1</version>
- </dependency>
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse
- m2e settings only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>${lifecycle.mapping.version}</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <versionRange>[1.2.4,)</versionRange>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
- <plugin>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>maven-paxexam-plugin</artifactId>
- <executions>
- <execution>
- <id>generate-config</id>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
+ <id>unpack-karaf-resources</id>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
+ <groupId>org.opendaylight.controller</groupId>
+ <includeArtifactIds>mockito-all,config-it-base,mdsal-it-base</includeArtifactIds>
+ <excludes>META-INF\/**</excludes>
+ <ignorePermissions>false</ignorePermissions>
+ </configuration>
</execution>
- </executions>
- <!-- PAX EXAM tests sometimes takes longer to run if
- not enough system resources are provided and
- default timeout of two minutes may be not enough
- on some jenkins jobs. In order to not loose
- results of these tests, but to prevent this
- tests of failing verifies sporadically
- this test suites are optional and should not
- fail build.
- -->
- <configuration>
- <testFailureIgnore>true</testFailureIgnore>
- </configuration>
+ </executions>
</plugin>
</plugins>
</build>
*/
package org.opendaylight.controller.test.sal.binding.it;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.baseModelBundles;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.bindingAwareSalBundles;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.configMinumumBundles;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.junitAndMockitoBundles;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.mdSalCoreBundles;
-import static org.opendaylight.controller.test.sal.binding.it.TestHelper.salTestModelBundles;
+import static org.ops4j.pax.exam.CoreOptions.maven;
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 javax.inject.Inject;
import org.junit.runner.RunWith;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.util.Filter;
-import org.osgi.framework.BundleContext;
@RunWith(PaxExam.class)
-public abstract class AbstractIT {
-
- public static final String CONTROLLER = "org.opendaylight.controller";
- public static final String YANGTOOLS = "org.opendaylight.yangtools";
-
- public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
- public static final String YANGTOOLS_MODELS = "org.opendaylight.yangtools.model";
+public abstract class AbstractIT extends AbstractMdsalTestBase {
@Inject
@Filter(timeout=120*1000)
BindingAwareBroker broker;
- @Inject
- BundleContext bundleContext;
-
- public BindingAwareBroker getBroker() {
- return broker;
+ @Override
+ public String getModuleName() {
+ return "binding-broker-impl";
}
- public void setBroker(final BindingAwareBroker broker) {
- this.broker = broker;
+ @Override
+ public String getInstanceName() {
+ return "binding-broker-impl";
}
- public BundleContext getBundleContext() {
- return bundleContext;
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven().groupId("org.opendaylight.controller").artifactId("features-mdsal").classifier("features")
+ .type("xml").versionAsInProject();
}
- public void setBundleContext(final BundleContext bundleContext) {
- this.bundleContext = bundleContext;
+ @Override
+ public String getFeatureName() {
+ return "odl-mdsal-broker";
}
- @Configuration
- public Option[] config() {
- return options(systemProperty("osgi.console").value("2401"), 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("openexi", "nagasena").versionAsInProject(),
- mavenBundle("openexi", "nagasena-rta").versionAsInProject(),
- //
- systemProperty("osgi.bundles.defaultStartLevel").value("4"),
- systemPackages("sun.nio.ch"),
-
- mdSalCoreBundles(),
- configMinumumBundles(),
- bindingAwareSalBundles(),
-
- // BASE Models
- baseModelBundles(),
- salTestModelBundles(),
-
- // Set fail if unresolved bundle present
- systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
- junitAndMockitoBundles());
+ @Override
+ protected Option[] getAdditionalOptions() {
+ return new Option[]{mavenBundle("org.opendaylight.controller", "sal-test-model").versionAsInProject()};
}
-
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
-import javax.inject.Inject;
import java.util.concurrent.Future;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.controller.sal.core.api.Broker;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.Lists;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.UnorderedContainer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.store.rev140422.lists.unordered.container.UnorderedList;
* covers creating, reading and deleting of an item in dataStore
*/
public class DataServiceIT extends AbstractIT {
-
protected DataBrokerService consumerDataService;
- @Inject
- Broker broker2;
-
/**
*
* Ignored this, because classes here are constructed from
*/
@Test
public void test() throws Exception {
- BindingAwareConsumer consumer1 = new BindingAwareConsumer() {
+ BindingAwareConsumer consumer = new BindingAwareConsumer() {
@Override
public void onSessionInitialized(final ConsumerContext session) {
consumerDataService = session.getSALService(DataBrokerService.class);
}
};
- broker.registerConsumer(consumer1);
+
+ broker.registerConsumer(consumer);
assertNotNull(consumerDataService);