Enabling checkstyle/spotbugs by default finds these, fix them up.
Change-Id: Ib407830f0a15cb4c04492f3c694fb463cdb30bad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
setTestOperData(this.execStatus.get(), testsCompleted);
} catch (final Exception e) {
// TODO: Use a singleton service to make sure the initial write is performed only once.
- LOG.warn("Working around Bugs 8829 and 6793 by ignoring exception from setTestOperData: {}", e);
+ LOG.warn("Working around Bugs 8829 and 6793 by ignoring exception from setTestOperData", e);
}
LOG.info("DsbenchmarkProvider initiated");
tx.commit().get();
txOk++;
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
txError++;
}
tx = dataBroker.newWriteOnlyTransaction();
try {
tx.commit().get();
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
}
}
}
tx.commit().get();
txOk++;
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
txError++;
}
tx = dataBroker.newWriteOnlyTransaction();
try {
tx.commit().get();
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
}
}
}
tx.commit().get();
txOk++;
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
txError++;
}
tx = domDataBroker.newWriteOnlyTransaction();
try {
tx.commit().get();
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Transaction failed: {}", e);
+ LOG.error("Transaction failed", e);
}
}
}
try {
chain.close();
} catch (final IllegalStateException e) {
- LOG.error("Transaction close failed,", e);
+ LOG.error("Transaction close failed", e);
}
LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
}
@Override
public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in TxchainBaDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
- cause);
+ LOG.error("Broken chain {} in TxchainBaDelete, transaction {}", chain, transaction.getIdentifier(), cause);
}
@Override
@Override
public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in TxchainBaDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
- cause);
+ LOG.error("Broken chain {} in TxchainBaDelete, transaction {}", chain, transaction.getIdentifier(), cause);
}
@Override
@Override
public void onTransactionChainFailed(final TransactionChain chain, final Transaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in DatastoreBaAbstractWrite, transaction {}, cause {}", chain,
- transaction.getIdentifier(), cause);
+ LOG.error("Broken chain {} in DatastoreBaAbstractWrite, transaction {}", chain, transaction.getIdentifier(),
+ cause);
}
@Override
import org.slf4j.LoggerFactory;
public class TxchainDomDelete extends DatastoreAbstractWriter implements DOMTransactionChainListener {
- private static final Logger LOG = LoggerFactory.getLogger(TxchainBaWrite.class);
+ private static final Logger LOG = LoggerFactory.getLogger(TxchainDomDelete.class);
private final DOMDataBroker domDataBroker;
public TxchainDomDelete(final DOMDataBroker domDataBroker, final int outerListElem, final int innerListElem,
@Override
public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in TxchainDomDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
- cause);
+ LOG.error("Broken chain {} in TxchainDomDelete, transaction {}", chain, transaction.getIdentifier(), cause);
}
@Override
@Override
public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in TxchainDomDelete, transaction {}, cause {}", chain, transaction.getIdentifier(),
- cause);
+ LOG.error("Broken chain {} in TxchainDomDelete, transaction {}", chain, transaction.getIdentifier(), cause);
}
@Override
@Override
public void onTransactionChainFailed(final DOMTransactionChain chain, final DOMDataTreeTransaction transaction,
final Throwable cause) {
- LOG.error("Broken chain {} in TxchainDomWrite, transaction {}, cause {}", chain, transaction.getIdentifier(),
- cause);
+ LOG.error("Broken chain {} in TxchainDomWrite, transaction {}", chain, transaction.getIdentifier(), cause);
}
@Override
package ntfbenchmark.impl;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NtfbenchNonblockingProducer extends AbstractNtfbenchProducer {
-
- private final SettableFuture<?> lastDeliveryFuture = SettableFuture.create();
-
+ private static final Logger LOG = LoggerFactory.getLogger(NtfbenchNonblockingProducer.class);
public NtfbenchNonblockingProducer(final NotificationPublishService publishService, final int iterations,
final int payloadSize) {
lastOkFuture = result;
}
} catch (final Exception e) {
+ LOG.debug("Failed to publish notification", e);
ntfError++;
}
}
*/
package ntfbenchmark.impl;
+import static com.google.common.base.Verify.verifyNotNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
final long startTime = System.nanoTime();
for (int i = 0; i < input.getProducers().intValue(); i++) {
- executor.submit(producers.get(i));
+ // FIXME: fools RV_RETURN_VALUE_IGNORED_BAD_PRACTICE for now, but we should check some more
+ verifyNotNull(executor.submit(producers.get(i)));
}
executor.shutdown();
try {
allListeners += listenerRegistration.getInstance().getReceived();
}
- final long listenerEndTime = System.nanoTime();
final long listenerElapsedTime = producerEndTime - startTime;
LOG.info("Test Done");
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
-
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInputBuilder;
import org.slf4j.LoggerFactory;
public class GlobalBindingRTCClient implements RTCClient {
-
private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCClient.class);
+
private final RpcbenchPayloadService service;
private final AtomicLong rpcOk = new AtomicLong(0);
private final AtomicLong rpcError = new AtomicLong(0);
private final GlobalRpcBenchInput inVal;
private final int inSize;
+ @Override
public long getRpcOk() {
return rpcOk.get();
}
+ @Override
public long getRpcError() {
return rpcError.get();
}
inVal = new GlobalRpcBenchInputBuilder().setPayload(listVals).build();
}
+ @Override
public void runTest(final int iterations) {
- int rpcOk = 0;
- int rpcError = 0;
+ int ok = 0;
+ int error = 0;
for (int i = 0; i < iterations; i++) {
Future<RpcResult<GlobalRpcBenchOutput>> output = service.globalRpcBench(inVal);
if (rpcResult.isSuccessful()) {
List<Payload> retVal = rpcResult.getResult().getPayload();
if (retVal.size() == inSize) {
- rpcOk++;
+ ok++;
}
else {
- rpcError++;
+ error++;
}
}
} catch (InterruptedException | ExecutionException e) {
- rpcError++;
+ error++;
LOG.error("Execution failed: ", e);
}
}
- this.rpcOk.addAndGet(rpcOk);
- this.rpcError.addAndGet(rpcError);
+ rpcOk.addAndGet(ok);
+ rpcError.addAndGet(error);
}
@Override
* 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 rpcbenchmark.impl;
public interface RTCClient {
long getRpcOk();
+
long getRpcError();
+
void runTest(int iterations);
+
void close();
}
import java.util.concurrent.Future;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
-
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput;
import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInputBuilder;
import org.slf4j.LoggerFactory;
public class RoutedBindingRTClient implements RTCClient {
- private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCClient.class);
+ private static final Logger LOG = LoggerFactory.getLogger(RoutedBindingRTClient.class);
private final RpcbenchPayloadService service;
private final AtomicLong rpcOk = new AtomicLong(0);
private final AtomicLong rpcError = new AtomicLong(0);
private final List<RoutedRpcBenchInput> inVal;
private final int inSize;
+ @Override
public long getRpcOk() {
return rpcOk.get();
}
+ @Override
public long getRpcError() {
return rpcError.get();
}
- public RoutedBindingRTClient(final RpcConsumerRegistry registry, final int inSize, final List<InstanceIdentifier<?>> routeIid) {
+ public RoutedBindingRTClient(final RpcConsumerRegistry registry, final int inSize,
+ final List<InstanceIdentifier<?>> routeIid) {
if (registry != null) {
this.service = registry.getRpcService(RpcbenchPayloadService.class);
} else {
}
+ @Override
public void runTest(final int iterations) {
- int rpcOk = 0;
- int rpcError = 0;
+ int ok = 0;
+ int error = 0;
int rpcServerCnt = inVal.size();
for (int i = 0; i < iterations; i++) {
if (rpcResult.isSuccessful()) {
List<Payload> retVal = rpcResult.getResult().getPayload();
if (retVal.size() == inSize) {
- rpcOk++;
+ ok++;
}
else {
- rpcError++;
+ error++;
}
}
} catch (InterruptedException | ExecutionException e) {
- rpcError++;
+ error++;
LOG.error("Execution failed: ", e);
}
}
- this.rpcOk.addAndGet(rpcOk);
- this.rpcError.addAndGet(rpcError);
+ rpcOk.addAndGet(ok);
+ rpcError.addAndGet(error);
}
@Override
// TODO Auto-generated method stub
}
-
}
*/
package rpcbenchmark.impl;
+import static com.google.common.base.Verify.verifyNotNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
public class RpcbenchmarkProvider implements AutoCloseable, RpcbenchmarkService {
private static final Logger LOG = LoggerFactory.getLogger(RpcbenchmarkProvider.class);
- private static final int testTimeout = 5;
+ private static final int TEST_TIMEOUT = 5;
private final GlobalBindingRTCServer globalServer;
private final AtomicReference<ExecStatus> execStatus = new AtomicReference<>(ExecStatus.Idle);
final List<RoutedRpcRegistration<?>> rpcRegs = new ArrayList<>();
switch (input.getOperation()) {
- case ROUTEDRTC:
- List<InstanceIdentifier<?>> routeIid = new ArrayList<>();
- for (int i = 0; i < input.getNumServers().intValue(); i++) {
- GlobalBindingRTCServer server = new GlobalBindingRTCServer();
- RoutedRpcRegistration<RpcbenchPayloadService> routedReg =
- providerRegistry.addRoutedRpcImplementation(RpcbenchPayloadService.class, server);
-
- KeyedInstanceIdentifier<RpcRoute, RpcRouteKey> iid =
- InstanceIdentifier
+ case ROUTEDRTC:
+ List<InstanceIdentifier<?>> routeIid = new ArrayList<>();
+ for (int i = 0; i < input.getNumServers().intValue(); i++) {
+ GlobalBindingRTCServer server = new GlobalBindingRTCServer();
+ RoutedRpcRegistration<RpcbenchPayloadService> routedReg =
+ providerRegistry.addRoutedRpcImplementation(RpcbenchPayloadService.class, server);
+
+ KeyedInstanceIdentifier<RpcRoute, RpcRouteKey> iid =
+ InstanceIdentifier
.create(RpcbenchRpcRoutes.class)
.child(RpcRoute.class, new RpcRouteKey(Integer.toString(i)));
- routeIid.add(iid);
- routedReg.registerPath(NodeContext.class, iid);
- rpcRegs.add(routedReg);
- }
+ routeIid.add(iid);
+ routedReg.registerPath(NodeContext.class, iid);
+ rpcRegs.add(routedReg);
+ }
- client = new RoutedBindingRTClient(providerRegistry, input.getPayloadSize().intValue(), routeIid);
- break;
+ client = new RoutedBindingRTClient(providerRegistry, input.getPayloadSize().intValue(), routeIid);
+ break;
- case GLOBALRTC:
- client = new GlobalBindingRTCClient(providerRegistry, input.getPayloadSize().intValue());
- break;
+ case GLOBALRTC:
+ client = new GlobalBindingRTCClient(providerRegistry, input.getPayloadSize().intValue());
+ break;
- default:
- LOG.error("Unsupported server/client type {}", input.getOperation());
- throw new IllegalArgumentException("Unsupported server/client type" + input.getOperation());
+ default:
+ LOG.error("Unsupported server/client type {}", input.getOperation());
+ throw new IllegalArgumentException("Unsupported server/client type" + input.getOperation());
}
try {
final Runnable testRun = () -> client.runTest(input.getIterations().intValue());
LOG.info("Test Started");
- long startTime = System.nanoTime();
+ final long startTime = System.nanoTime();
- for (int i = 0; i < input.getNumClients().intValue(); i++ ) {
- executor.submit(testRun);
+ for (int i = 0; i < input.getNumClients().intValue(); i++) {
+ // FIXME: fools RV_RETURN_VALUE_IGNORED_BAD_PRACTICE, but we should check more
+ verifyNotNull(executor.submit(testRun));
}
executor.shutdown();
try {
- executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
+ executor.awaitTermination(TEST_TIMEOUT, TimeUnit.MINUTES);
} catch (final InterruptedException e) {
- LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout);
+ LOG.error("Out of time: test did not finish within the {} min deadline ", TEST_TIMEOUT);
}
long endTime = System.nanoTime();
.setGlobalRtcClientError(client.getRpcError())
.setGlobalRtcClientOk(client.getRpcOk())
.setExecTime(TimeUnit.NANOSECONDS.toMillis(elapsedTime))
- .setRate((client.getRpcOk() + client.getRpcError()) * 1000000000 / elapsedTime)
+ .setRate(
+ (client.getRpcOk() + client.getRpcError()) * 1000000000 / elapsedTime)
.build();
return RpcResultBuilder.success(output).buildFuture();
} finally {
* @return An array of additional config options
*/
protected Option[] getAdditionalOptions() {
- return null;
+ return new Option[0];
}
/**
import org.ops4j.pax.exam.util.PathUtils;
/**
+ * Helper utility for running IT tests.
+ *
* @deprecated Use config-it and/or mdsal-it instead.
*/
@Deprecated
-public class TestHelper {
+public final class TestHelper {
public static final String CONTROLLER = "org.opendaylight.controller";
public static final String MDSAL = "org.opendaylight.mdsal";
public static final String CONTROLLER_MODELS = "org.opendaylight.controller.model";
public static final String MDSAL_MODELS = "org.opendaylight.mdsal.model";
+ private TestHelper() {
+
+ }
+
public static Option mdSalCoreBundles() {
- return new DefaultCompositeOption( //
- mavenBundle(YANGTOOLS, "concepts").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "util").versionAsInProject(), // //
- mavenBundle(MDSAL, "yang-binding").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(), // //
- mavenBundle("tech.pantheon", "triemap").versionAsInProject(), // //
- mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(), // //
- mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(), // //
-
- mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(), //
+ return new DefaultCompositeOption(
+ mavenBundle(YANGTOOLS, "concepts").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "util").versionAsInProject(),
+ mavenBundle(MDSAL, "yang-binding").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-common").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "object-cache-api").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "object-cache-guava").versionAsInProject(),
+ mavenBundle("tech.pantheon", "triemap").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-common-api").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-common-impl").versionAsInProject(),
+
+ mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),
mavenBundle("com.google.guava", "guava").versionAsInProject(),
mavenBundle("com.github.romix", "java-concurrent-hash-trie-map").versionAsInProject()
);
public static Option configMinumumBundles() {
return new DefaultCompositeOption(
- mavenBundle(CONTROLLER, "config-api").versionAsInProject(), // //
+ mavenBundle(CONTROLLER, "config-api").versionAsInProject(),
bindingAwareSalBundles(),
mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
systemPackages("sun.nio.ch", "sun.misc"),
- mavenBundle(CONTROLLER, "config-manager").versionAsInProject(), // //
- mavenBundle(CONTROLLER, "config-util").versionAsInProject(), // //
- mavenBundle("commons-io", "commons-io").versionAsInProject(), //
- mavenBundle(CONTROLLER, "config-manager-facade-xml").versionAsInProject(), //
- mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(), //
- mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(), //
+ mavenBundle(CONTROLLER, "config-manager").versionAsInProject(),
+ mavenBundle(CONTROLLER, "config-util").versionAsInProject(),
+ mavenBundle("commons-io", "commons-io").versionAsInProject(),
+ mavenBundle(CONTROLLER, "config-manager-facade-xml").versionAsInProject(),
+ mavenBundle(CONTROLLER, "yang-jmx-generator").versionAsInProject(),
+ mavenBundle(CONTROLLER, "config-persister-api").versionAsInProject(),
- mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(), //
+ mavenBundle(CONTROLLER, "config-persister-impl").versionAsInProject(),
mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"),
mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"),
}
public static Option bindingAwareSalBundles() {
- return new DefaultCompositeOption( //
+ return new DefaultCompositeOption(
mdSalCoreBundles(),
- mavenBundle("org.javassist", "javassist").versionAsInProject(), // //
-
- mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(), // //
- mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(), //
- mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(), //
- mavenBundle(MDSAL, "mdsal-binding-generator-api").versionAsInProject(), //
- mavenBundle(MDSAL, "mdsal-binding-generator-util").versionAsInProject(), //
+ mavenBundle("org.javassist", "javassist").versionAsInProject(),
+
+ mavenBundle(YANGTOOLS, "yang-data-api").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-data-util").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-data-impl").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-model-api").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-model-util").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-parser-api").versionAsInProject(),
+ mavenBundle(YANGTOOLS, "yang-parser-impl").versionAsInProject(),
+ mavenBundle(MDSAL, "mdsal-binding-generator-api").versionAsInProject(),
+ mavenBundle(MDSAL, "mdsal-binding-generator-util").versionAsInProject(),
mavenBundle(MDSAL, "mdsal-binding-generator-impl").versionAsInProject(),
mavenBundle(MDSAL, "mdsal-binding-dom-codec").versionAsInProject(),
- mavenBundle("org.antlr", "antlr4-runtime").versionAsInProject(), // //
+ mavenBundle("org.antlr", "antlr4-runtime").versionAsInProject(),
- mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(), //
- mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(), // //
+ mavenBundle(CONTROLLER, "sal-binding-util").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-common-util").versionAsInProject(),
- mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(), //
- mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(), // //
+ mavenBundle(CONTROLLER, "sal-core-api").versionAsInProject().update(),
+ mavenBundle(CONTROLLER, "sal-binding-api").versionAsInProject(),
- mavenBundle("com.lmax", "disruptor").versionAsInProject(), //
- mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(), // //
- mavenBundle(CONTROLLER, "sal-dom-config").versionAsInProject(), // //
+ mavenBundle("com.lmax", "disruptor").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-broker-impl").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-dom-config").versionAsInProject(),
- mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(), //
- mavenBundle(CONTROLLER, "sal-dom-broker-config").versionAsInProject(), // //
+ mavenBundle(CONTROLLER, "sal-inmemory-datastore").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-dom-broker-config").versionAsInProject(),
- mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(), //
+ mavenBundle(CONTROLLER, "sal-core-spi").versionAsInProject().update(),
- mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(), // //
- mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(), //
+ mavenBundle(CONTROLLER, "sal-binding-broker-impl").versionAsInProject(),
+ mavenBundle(CONTROLLER, "sal-binding-config").versionAsInProject(),
- systemProperty("netconf.config.persister.active").value("1"), //
+ systemProperty("netconf.config.persister.active").value("1"),
systemProperty("netconf.config.persister.1.storageAdapterClass").value(
- "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"), //
+ "org.opendaylight.controller.config.persist.storage.file.xml.XmlFileStorageAdapter"),
systemProperty("netconf.config.persister.1.properties.fileStorage")
- .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"), //
- systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1") //
+ .value(PathUtils.getBaseDir() + "/src/test/resources/controller.xml"),
+ systemProperty("netconf.config.persister.1.properties.numberOfBackups").value("1")
);
-
}
public static Option bindingIndependentSalBundles() {
return new DefaultCompositeOption(
);
-
}
public static Option protocolFrameworkBundles() {
return new DefaultCompositeOption(
- mavenBundle("io.netty", "netty-common").versionAsInProject(), //
- mavenBundle("io.netty", "netty-buffer").versionAsInProject(), //
- mavenBundle("io.netty", "netty-handler").versionAsInProject(), //
- mavenBundle("io.netty", "netty-codec").versionAsInProject(), //
- mavenBundle("io.netty", "netty-transport").versionAsInProject(), //
- mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(), //
+ mavenBundle("io.netty", "netty-common").versionAsInProject(),
+ mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
+ mavenBundle("io.netty", "netty-handler").versionAsInProject(),
+ mavenBundle("io.netty", "netty-codec").versionAsInProject(),
+ mavenBundle("io.netty", "netty-transport").versionAsInProject(),
+ mavenBundle(CONTROLLER, "netty-config-api").versionAsInProject(),
mavenBundle(CONTROLLER, "protocol-framework").versionAsInProject()
);
-
}
public static Option flowCapableModelBundles() {
- return new DefaultCompositeOption( //
- mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject() //
+ return new DefaultCompositeOption(
+ mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject()
);
-
}
/**
+ * Return an option containing models for testing purposes.
+ *
* @return option containing models for testing purposes
*/
public static Option salTestModelBundles() {
- return new DefaultCompositeOption( //
+ return new DefaultCompositeOption(
mavenBundle(CONTROLLER, "sal-test-model").versionAsInProject()
);
-
}
public static Option baseModelBundles() {
- return new DefaultCompositeOption( //
+ return new DefaultCompositeOption(
mavenBundle(MDSAL + ".model", "yang-ext").versionAsInProject(),
mavenBundle(MDSAL_MODELS, "ietf-type-util").versionAsInProject(),
mavenBundle(MDSAL_MODELS, "ietf-inet-types").versionAsInProject(),
import org.ops4j.pax.exam.util.Filter;
/**
- * covers creating, reading and deleting of an item in dataStore
+ * Covers creating, reading and deleting of an item in dataStore.
*/
public class DataServiceIT extends AbstractIT {
@Inject
DataBroker dataBroker;
/**
- *
- * Ignored this, because classes here are constructed from
- * very different class loader as MD-SAL is run into,
+ * Ignored this, because classes here are constructed from very different class loader as MD-SAL is run into,
* this is code is run from different classloader.
- *
- * @throws Exception
*/
@Test
public void test() throws Exception {
assertFalse(readedData2.isPresent());
}
-
private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
UnorderedListKey key = new UnorderedListKey(string);
return InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key)
NotificationProviderService notificationService;
/**
- * test of delivering of notification
- * @throws Exception
+ * Test of delivering of notification.
*/
@Test
public void notificationTest() throws Exception {
/**
* Check that one notification was delivered and has correct cookie.
- *
*/
assertEquals(1, listener1.notificationBag.size());
assertEquals("rainy day", listener1.notificationBag.get(0).getReason());
/**
* Check that 3 notification was delivered to both listeners (first one
* received 4 in total, second 3 in total).
- *
*/
assertEquals(4, listener1.notificationBag.size());
assertEquals(3, listener2.notificationBag.size());
*/
assertEquals(5, listener1.notificationBag.size());
assertEquals(3, listener2.notificationBag.size());
-
}
/**
- * Creates instance of the type OutOfPixieDustNotification. It is
- * used only for testing purpose.
+ * Creates instance of the type OutOfPixieDustNotification. It is used only for testing purpose.
*
- * @param reason
- * @param days
* @return instance of the type OutOfPixieDustNotification
*/
- public static OutOfPixieDustNotification noDustNotification(String reason, int days) {
+ public static OutOfPixieDustNotification noDustNotification(final String reason, final int days) {
OutOfPixieDustNotificationBuilder ret = new OutOfPixieDustNotificationBuilder();
ret.setReason(reason).setDaysTillNewDust(days);
return ret.build();
* the type {@link OutOfFairyDustNotification}.
*/
public static class NotificationTestListener implements OpendaylightTestNotificationListener {
-
List<OutOfPixieDustNotification> notificationBag = new ArrayList<>();
@Override
- public void onOutOfPixieDustNotification(OutOfPixieDustNotification arg0) {
+ public void onOutOfPixieDustNotification(final OutOfPixieDustNotification arg0) {
notificationBag.add(arg0);
}
-
}
}
import org.slf4j.LoggerFactory;
/**
- * covers routed rpc creation, registration, invocation, unregistration
+ * Covers routed rpc creation, registration, invocation, unregistration.
*/
public class RoutedServiceIT extends AbstractIT {
RpcProviderRegistry rpcProviderRegistry;
/**
- * prepare mocks
+ * Prepare mocks.
*/
@Before
public void setUp() {
firstReg.registerPath(TestContext.class, nodeOnePath);
/**
- * Consumer creates addFlow message for node one and sends it to the
- * MD-SAL
+ * Consumer creates addFlow message for node one and sends it to the MD-SAL.
*/
final RoutedSimpleRouteInput simpleRouteFirstFoo = createSimpleRouteInput(nodeOnePath);
consumerService.routedSimpleRoute(simpleRouteFirstFoo);
/**
- * Verifies that implementation of the first provider received the same
- * message from MD-SAL.
+ * Verifies that implementation of the first provider received the same message from MD-SAL.
*/
verify(odlRoutedService1).routedSimpleRoute(simpleRouteFirstFoo);
/**
secondReg.registerPath(TestContext.class, nodeTwo);
/**
- * Consumer sends message to nodeTwo for three times. Should be
- * processed by second instance.
+ * Consumer sends message to nodeTwo for three times. Should be processed by second instance.
*/
final RoutedSimpleRouteInput simpleRouteSecondFoo = createSimpleRouteInput(nodeTwo);
consumerService.routedSimpleRoute(simpleRouteSecondFoo);
consumerService.routedSimpleRoute(simpleRouteSecondFoo);
/**
- * Verifies that second instance was invoked 3 times with second message
- * and first instance wasn't invoked.
- *
+ * Verifies that second instance was invoked 3 times with second message and first instance wasn't invoked.
*/
verify(odlRoutedService2, times(3)).routedSimpleRoute(simpleRouteSecondFoo);
verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteSecondFoo);
secondReg.registerPath(TestContext.class, nodeOnePath);
/**
- * A consumer sends third message to node 1
+ * A consumer sends third message to node 1.
*/
final RoutedSimpleRouteInput simpleRouteThirdFoo = createSimpleRouteInput(nodeOnePath);
consumerService.routedSimpleRoute(simpleRouteThirdFoo);
/**
- * Verifies that provider 1 wasn't invoked and provider 2 was invoked 1
- * time.
+ * Verifies that provider 1 wasn't invoked and provider 2 was invoked 1 time.
* TODO: fix unregister path
*/
//verify(odlRoutedService1, times(0)).routedSimpleRoute(simpleRouteThirdFoo);
verify(odlRoutedService2).routedSimpleRoute(simpleRouteThirdFoo);
-
}
/**
- * Returns node reference from string which represents path
+ * Returns node reference from string which represents path.
*
- * @param string
- * string with key(path)
+ * @param string string with key(path)
* @return instance identifier to {@link UnorderedList}
*/
private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
- final UnorderedListKey key = new UnorderedListKey(string);
- final InstanceIdentifier<UnorderedList> path = InstanceIdentifier.builder(Lists.class)
+ return InstanceIdentifier.builder(Lists.class)
.child(UnorderedContainer.class)
- .child(UnorderedList.class, key)
+ .child(UnorderedList.class, new UnorderedListKey(string))
.build();
-
- return path;
}
/**
- * Creates flow AddFlowInput for which only node and cookie are set
+ * Creates flow AddFlowInput for which only node and cookie are set.
*
- * @param node
- * NodeRef value
+ * @param node NodeRef value
* @return simpleRouteInput instance
*/
static RoutedSimpleRouteInput createSimpleRouteInput(final InstanceIdentifier<UnorderedList> node) {
@RunWith(PaxExam.class)
public class ToasterTest extends AbstractMdsalTestBase {
@Inject
- @Filter(timeout = 60*1000)
+ @Filter(timeout = 60 * 1000)
KitchenService kitchenService;
@Override
// Make toasts using OSGi service
success &= kitchenService.makeBreakfast(EggsType.SCRAMBLED, HashBrown.class, 4).get().isSuccessful();
- success &= kitchenService.makeBreakfast(EggsType.POACHED, WhiteBread.class, 8 ).get().isSuccessful();
+ success &= kitchenService.makeBreakfast(EggsType.POACHED, WhiteBread.class, 8).get().isSuccessful();
assertTrue("Not all breakfasts succeeded", success);