<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgp-parent</artifactId>
<version>0.3.1-SNAPSHOT</version>
</parent>
- <artifactId>features-bgp</artifactId>
+ <artifactId>features-bgp</artifactId>
- <packaging>jar</packaging>
+ <packaging>jar</packaging>
- <properties>
- <features.file>features.xml</features.file>
- <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
- <mdsal.version>1.1-SNAPSHOT</mdsal.version>
- <netconf.version>0.2.5-SNAPSHOT</netconf.version>
- <commons.opendaylight.version>1.4.2-SNAPSHOT</commons.opendaylight.version>
- </properties>
+ <properties>
+ <features.file>features.xml</features.file>
+ <yangtools.version>0.6.2-SNAPSHOT</yangtools.version>
+ <mdsal.version>1.1-SNAPSHOT</mdsal.version>
+ <netconf.version>0.2.5-SNAPSHOT</netconf.version>
+ <commons.opendaylight.version>1.4.2-SNAPSHOT</commons.opendaylight.version>
+ </properties>
- <!-- Testing -->
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>features-yangtools</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
- <version>${yangtools.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-mdsal</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
- <version>${mdsal.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-netconf</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
- <version>${netconf.version}</version>
- </dependency>
- <!-- Required for testing -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- <version>0.2.5-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.bgpcep</groupId>
- <artifactId>pcep-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.bgpcep</groupId>
- <artifactId>pcep-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
+ <!-- Testing -->
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>features-netconf</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${netconf.version}</version>
+ </dependency>
+ <!-- Required for testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ <version>0.2.5-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.bgpcep</groupId>
+ <artifactId>pcep-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>concepts</artifactId>
<version>${project.version}</version>
<artifactId>bgp-linkstate</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-linkstate-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-parser-api</artifactId>
<artifactId>bgp-parser-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-parser-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-parser-impl</artifactId>
<artifactId>bgp-rib-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-rib-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-rib-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-testtool</artifactId>
<artifactId>bgp-topology-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-topology-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-util</artifactId>
<artifactId>pcep-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-ietf-stateful02</artifactId>
<artifactId>pcep-topology-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-topology-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-segment-routing</artifactId>
<artifactId>pcep-tunnel-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-tunnel-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rsvp-api</artifactId>
<artifactId>programming-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>programming-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>programming-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>programming-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>programming-topology-api</artifactId>
<artifactId>topology-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>topology-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>topology-segment-routing</artifactId>
<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
<feature version='${project.version}'>odl-bgpcep-dependencies</feature>
<bundle>mvn:org.opendaylight.bgpcep/rsvp-api/${project.version}</bundle>
<bundle>mvn:org.opendaylight.bgpcep/pcep-api/${project.version}</bundle>
- <bundle>mvn:org.opendaylight.bgpcep/pcep-api-config/${project.version}</bundle>
</feature>
<feature name='odl-pcep-spi' version='${project.version}'>
<artifactId>bgp-linkstate</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-linkstate-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-parser-api</artifactId>
<artifactId>bgp-parser-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-parser-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-parser-impl</artifactId>
<artifactId>bgp-rib-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-rib-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-rib-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-testtool</artifactId>
<artifactId>bgp-topology-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-topology-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-util</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-update-mock-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<!-- Outside of this component -->
<dependency>
<artifactId>topology-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>topology-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
import com.google.common.util.concurrent.CheckedFuture;
import java.io.IOException;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.opendaylight.yangtools.yang.parser.impl.util.URLSchemaContextResolver;
+import org.opendaylight.yangtools.yang.parser.repo.URLSchemaContextResolver;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleListener;
import org.osgi.framework.Filter;
final Field contextResolverField = schemaService.getClass().getDeclaredField("contextResolver");
contextResolverField.setAccessible(true);
- contextResolverField.set(schemaService, mockedContextResolver);
+ final Field modifiersField = Field.class.getDeclaredField("modifiers");
+ modifiersField.setAccessible(true);
+ modifiersField.setInt(contextResolverField, contextResolverField.getModifiers() & ~Modifier.FINAL);
+
+ contextResolverField.set(schemaService, mockedContextResolver);
}
protected List<ModuleFactory> getModuleFactories() {
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
--->
-<projectDescription>
-
- <name>bgp-topology-provider-config</name>
-
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/BGP_LS_PCEP:Main</url>
- <tag>HEAD</tag>
- </scm>
- <parent>
- <groupId>org.opendaylight.bgpcep</groupId>
- <artifactId>bgp-parent</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>bgp-topology-provider-config</artifactId>
- <description>BGP Topology provider CONFIG</description>
- <packaging>bundle</packaging>
- <name>${project.artifactId}</name>
- <prerequisites>
- <maven>3.0.4</maven>
- </prerequisites>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
--->
-<projectDescription>
-
- <name>bgp-update-mock-config</name>
-
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/BGP_LS_PCEP:Main</url>
- <tag>HEAD</tag>
- </scm>
- <parent>
- <groupId>org.opendaylight.bgpcep</groupId>
- <artifactId>bgp-parent</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>bgp-update-mock-config</artifactId>
- <description>BGP UPDATE MOCK CONFIG</description>
- <packaging>bundle</packaging>
- <name>${project.artifactId}</name>
- <prerequisites>
- <maven>3.0.4</maven>
- </prerequisites>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>threadpool-config-api</artifactId>
- <version>${controller.config.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-rib-mock</artifactId>
- </dependency>
-
- <!--test dependencies -->
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>${controller.config.version}</version>
- <scope>test</scope>
- <type>test-jar</type>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-manager</artifactId>
- <version>${controller.config.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-util</artifactId>
- <version>${controller.config.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>mockito-configuration</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>threadpool-config-impl</artifactId>
- <version>${controller.config.version}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-/*
- * 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-mock yang module local name: bgp-mock
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 12:46:58 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.mock;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.Nullable;
-
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
-import org.opendaylight.protocol.bgp.rib.mock.BGPMock;
-import org.opendaylight.protocol.bgp.util.BinaryBGPDumpFileParser;
-import org.opendaylight.protocol.bgp.util.HexDumpBGPFileParser;
-
-/**
-*
-*/
-public final class BgpMockModule extends org.opendaylight.controller.config.yang.bgp.mock.AbstractBgpMockModule {
-
- private List<byte[]> bgpMessages;
-
- public BgpMockModule(org.opendaylight.controller.config.api.ModuleIdentifier name,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(name, dependencyResolver);
- }
-
- public BgpMockModule(org.opendaylight.controller.config.api.ModuleIdentifier name,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, BgpMockModule oldModule,
- java.lang.AutoCloseable oldInstance) {
- super(name, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void validate() {
- super.validate();
- JmxAttributeValidationException.checkCondition(!(getBinDump() != null && getHexDump() != null),
- "Both 'HexDump' and 'BinDump' contain value", this.binDumpJmxAttribute);
- if (getBinDump() == null && getHexDump() == null) {
- this.bgpMessages = new ArrayList<>();
- } else if (getHexDump() != null) {
- try {
- this.bgpMessages = HexDumpBGPFileParser.parseMessages(getHexDump());
- this.bgpMessages = Lists.newArrayList(fixMessages(this.bgpMessages));
- } catch (final Exception e) {
- JmxAttributeValidationException.wrap(e, "Error while parsing HexDump", this.hexDumpJmxAttribute);
- }
- } else {
- try {
- this.bgpMessages = BinaryBGPDumpFileParser.parseMessages(getBinDump());
- } catch (final Exception e) {
- JmxAttributeValidationException.wrap(e, "Error while parsing BinDump", this.binDumpJmxAttribute);
- }
- }
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- try {
- return new BGPMock(getEventBusDependency(), ServiceLoaderBGPExtensionProviderContext.createConsumerContext().getMessageRegistry(), this.bgpMessages);
- } catch (final Exception e) {
- throw new RuntimeException("Failed to create consumer context.", e);
- }
- }
-
- private Collection<byte[]> fixMessages(Collection<byte[]> bgpMessages) {
- return Collections2.transform(bgpMessages, new Function<byte[], byte[]>() {
-
- @Nullable
- @Override
- public byte[] apply(@Nullable byte[] input) {
- final byte[] ret = new byte[input.length + 1];
- // ff
- ret[0] = -1;
- for (int i = 0; i < input.length; i++) {
- ret[i + 1] = input[i];
- }
- return ret;
- }
- });
- }
-}
+++ /dev/null
-/*
- * 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: bgp-mock yang module local name: bgp-mock
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Nov 06 12:46:58 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.bgp.mock;
-
-/**
-*
-*/
-public class BgpMockModuleFactory extends org.opendaylight.controller.config.yang.bgp.mock.AbstractBgpMockModuleFactory {
-
-}
+++ /dev/null
-// vi: set smarttab et sw=4 tabstop=4:
-module bgp-mock {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:bgp:mock";
- prefix "th-java";
-
- import config { prefix config; revision-date 2013-04-05; }
- import threadpool { prefix th; revision-date 2013-04-09; }
- import bgp-listener { prefix bgpl; revision-date 2013-04-09; }
-
-
- organization "Cisco Systems, Inc.";
-
- contact "Robert Varga <rovarga@cisco.com>";
-
- description
- "This module contains the base YANG definitions for
- BGP message parser pure Java implementation.
-
- Copyright (c)2013 Cisco Systems, Inc. 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";
-
- revision "2013-04-09" {
- description
- "Initial version.";
- }
-
- identity bgp-mock {
- base config:module-type;
- config:provided-service bgpl:listener;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case bgp-mock {
- when "/config:modules/config:module/config:type = 'bgp-mock'";
- container eventBus {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity th:eventbus;
- }
- }
- }
-
- leaf hexDump {
- type string;
- }
-
- leaf binDump {
- type binary;
- }
- }
- }
-}
-
+++ /dev/null
-/*
- * 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.controller.config.yang.bgp.mock;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.ValidationException;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleFactory;
-import org.opendaylight.controller.config.yang.threadpool.impl.EventBusModuleMXBean;
-
-public class BgpMockModuleTest extends AbstractConfigTest {
-
- private final String instanceName = "bgp-mock";
-
- private BgpMockModuleFactory factory;
-
- private EventBusModuleFactory eventBusFactory;
-
- @Before
- public void setUp() throws Exception {
- this.factory = new BgpMockModuleFactory();
- this.eventBusFactory = new EventBusModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, this.eventBusFactory));
- }
-
- @Test
- public void testValidationExceptionBothAttributesSet() throws InstanceAlreadyExistsException {
- try {
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, new byte[] { 1 }, "hexMsg",
- this.eventBusFactory.getImplementationName());
- transaction.validateConfig();
- fail();
- } catch (ValidationException e) {
- assertTrue(e.getMessage().contains("Both 'HexDump' and 'BinDump' contain value"));
- }
- }
-
- @Test
- public void testCreateBean() throws Exception {
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, null, "hexString",
- this.eventBusFactory.getImplementationName());
- transaction.validateConfig();
- CommitStatus status = transaction.commit();
- assertBeanCount(1, factory.getImplementationName());
- assertStatus(status, 2, 0, 0);
- }
-
- public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
- final String instanceName, final byte[] binDump, final String hexDump, final String eventBusImplName)
- throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(moduleName, instanceName);
- BgpMockModuleMXBean mxBean = transaction.newMBeanProxy(nameCreated, BgpMockModuleMXBean.class);
- mxBean.setBinDump(binDump);
- mxBean.setHexDump(hexDump);
- mxBean.setEventBus(createEventBus(transaction, eventBusImplName, "event-bus1"));
- return nameCreated;
- }
-
- public static ObjectName createEventBus(final ConfigTransactionJMXClient transaction, final String moduleName, final String instanceName)
- throws InstanceAlreadyExistsException {
- ObjectName nameCreated = transaction.createModule(moduleName, instanceName);
- transaction.newMBeanProxy(nameCreated, EventBusModuleMXBean.class);
- return nameCreated;
- }
-
-}
<artifactId>pcep-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-ietf-stateful02</artifactId>
<artifactId>pcep-topology-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-topology-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-tunnel-api</artifactId>
<artifactId>pcep-tunnel-provider</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-tunnel-provider-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<!-- Stuff outside of this component -->
<dependency>
<artifactId>programming-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>programming-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>programming-topology-api</artifactId>
<artifactId>topology-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>topology-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>topology-tunnel-api</artifactId>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
--->
-<projectDescription>
-
- <name>programming-impl-config</name>
-
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
- 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
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/BGP_LS_PCEP:Main</url>
- <tag>HEAD</tag>
- </scm>
- <parent>
- <groupId>org.opendaylight.bgpcep</groupId>
- <artifactId>programming-parent</artifactId>
- <version>0.3.1-SNAPSHOT</version>
- </parent>
-
- <artifactId>programming-impl-config</artifactId>
- <description>Programming implementation CONFIG</description>
- <packaging>bundle</packaging>
- <name>${project.artifactId}</name>
- <prerequisites>
- <maven>3.0.4</maven>
- </prerequisites>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
import com.google.common.io.Resources;
import java.io.IOException;
import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-import org.opendaylight.yangtools.yang.parser.impl.util.URLSchemaContextResolver;
+import org.opendaylight.yangtools.yang.parser.repo.URLSchemaContextResolver;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleListener;
import org.osgi.framework.Filter;
final Field contextResolverField = schemaService.getClass().getDeclaredField("contextResolver");
contextResolverField.setAccessible(true);
+
+ final Field modifiersField = Field.class.getDeclaredField("modifiers");
+ modifiersField.setAccessible(true);
+ modifiersField.setInt(contextResolverField, contextResolverField.getModifiers() & ~Modifier.FINAL);
+
contextResolverField.set(schemaService, mockedContextResolver);
}
<artifactId>programming-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>programming-impl-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>programming-spi</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>programming-spi-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>programming-topology-api</artifactId>
<artifactId>topology-api</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>topology-api-config</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>topology-segment-routing</artifactId>