This fixes up warnings/checkstyle and flips the enforcement switch.
Change-Id: I22754c767ef643d703286a30252cf57006062ade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
</dependencies>
<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+
<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>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>org.jacoco</groupId>
- <artifactId>
- jacoco-maven-plugin
- </artifactId>
- <versionRange>
- [0.7.2.201409121644,)
- </versionRange>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
+ <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>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <versionRange>[0.7.2.201409121644,)</versionRange>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
* 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.dsbenchmark;
import java.util.ArrayList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerListKey;
public final class BaListBuilder {
+ private BaListBuilder() {
+
+ }
+
public static List<OuterList> buildOuterList(final int outerElements, final int innerElements) {
List<OuterList> outerList = new ArrayList<>(outerElements);
for (int j = 0; j < outerElements; j++) {
outerList.add(new OuterListBuilder()
- .setId( j )
+ .setId(j)
.setInnerList(buildInnerList(j, innerElements))
- .withKey(new OuterListKey( j ))
+ .withKey(new OuterListKey(j))
.build());
}
return outerList;
}
- private static List<InnerList> buildInnerList( final int index, final int elements ) {
- List<InnerList> innerList = new ArrayList<>( elements );
+ private static List<InnerList> buildInnerList(final int index, final int elements) {
+ List<InnerList> innerList = new ArrayList<>(elements);
final String itemStr = "Item-" + String.valueOf(index) + "-";
for (int i = 0; i < elements; i++) {
innerList.add(new InnerListBuilder()
- .withKey( new InnerListKey( i ) )
+ .withKey(new InnerListKey(i))
.setName(i)
- .setValue( itemStr + String.valueOf( i ) )
+ .setValue(itemStr + String.valueOf(i))
.build());
}
return innerList;
protected final StartTestInput.DataStore dataStore;
protected final Random rn = new Random();
-
protected int txOk = 0;
protected int txError = 0;
-
public DatastoreAbstractWriter(final StartTestInput.Operation oper,
- final int outerListElem, final int innerListElem, final long writesPerTx, final DataStore dataStore) {
+ final int outerListElem, final int innerListElem, final long writesPerTx, final DataStore dataStore) {
this.outerListElem = outerListElem;
this.innerListElem = innerListElem;
this.writesPerTx = writesPerTx;
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.outer.list.InnerList;
import org.opendaylight.yangtools.yang.common.QName;
// Outer List Qname identifier for yang model's 'id'
private static final org.opendaylight.yangtools.yang.common.QName OL_ID = QName.create(OuterList.QNAME, "id");
+ private DomListBuilder() {
+
+ }
+
public static List<MapEntryNode> buildOuterList(final int outerElements, final int innerElements) {
List<MapEntryNode> outerList = new ArrayList<>(outerElements);
for (int j = 0; j < outerElements; j++) {
return outerList;
}
- private static MapNode buildInnerList(final int index, final int elements ) {
+ private static MapNode buildInnerList(final int index, final int elements) {
CollectionNodeBuilder<MapEntryNode, MapNode> innerList = ImmutableNodes.mapNodeBuilder(InnerList.QNAME);
final String itemStr = "Item-" + String.valueOf(index) + "-";
this.simpleTxDataBroker = simpleTxDataBroker;
}
+ @SuppressWarnings("checkstyle:illegalCatch")
public void init() {
listenerProvider.setDataBroker(simpleTxDataBroker);
}
@Override
+ @SuppressWarnings("checkstyle:illegalCatch")
public ListenableFuture<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
LOG.info("Starting the data store benchmark test, input: {}", input);
// Create listeners on OPERATIONAL and CONFIG test data subtrees
listenerProvider.createAndRegisterListeners(input.getListeners().intValue());
- long startTime, endTime, listCreateTime, execTime;
- startTime = System.nanoTime();
+ long startTime = System.nanoTime();
dsWriter.createList();
- endTime = System.nanoTime();
- listCreateTime = (endTime - startTime) / 1000;
+ long endTime = System.nanoTime();
+ final long listCreateTime = (endTime - startTime) / 1000;
// Run the test and measure the execution time
+ long execTime;
try {
startTime = System.nanoTime();
dsWriter.executeList();
private List<MapEntryNode> list;
public SimpletxDomWrite(final DOMDataBroker domDataBroker, final StartTestInput.Operation oper,
- final int outerListElem, final int innerListElem, final long putsPerTx, final DataStore dataStore ) {
+ final int outerListElem, final int innerListElem, final long putsPerTx, final DataStore dataStore) {
super(oper, outerListElem, innerListElem, putsPerTx, dataStore);
this.domDataBroker = domDataBroker;
LOG.debug("Created SimpletxDomWrite");
}
@Override
- public void onFailure(final Throwable t) {
- LOG.error("Transaction failed, {}", t);
+ public void onFailure(final Throwable cause) {
+ LOG.error("Transaction failed", cause);
txError++;
}
}, MoreExecutors.directExecutor());
private List<OuterList> list;
public TxchainBaWrite(final DataBroker bindingDataBroker, final Operation oper,
- final int outerListElem, final int innerListElem, final long writesPerTx, final DataStore dataStore) {
+ final int outerListElem, final int innerListElem, final long writesPerTx, final DataStore dataStore) {
super(oper, outerListElem, innerListElem, writesPerTx, dataStore);
this.bindingDataBroker = bindingDataBroker;
LOG.debug("Created TxchainBaWrite");
}
@Override
- public void onFailure(final Throwable t) {
- LOG.error("Transaction failed, {}", t);
+ public void onFailure(final Throwable cause) {
+ LOG.error("Transaction failed", cause);
txError++;
}
}, MoreExecutors.directExecutor());
LOG.debug("DatastoreBaAbstractWrite closed successfully, chain {}", chain);
}
-}
\ No newline at end of file
+}
}
@Override
- public void onFailure(final Throwable t) {
- LOG.error("Transaction failed, {}", t);
+ public void onFailure(final Throwable cause) {
+ LOG.error("Transaction failed", cause);
txError++;
}
}, MoreExecutors.directExecutor());
private final DOMDataBroker domDataBroker;
private List<MapEntryNode> list;
- public TxchainDomWrite(final DOMDataBroker domDataBroker, final StartTestInput.Operation oper, final int outerListElem,
- final int innerListElem, final long writesPerTx, final DataStore dataStore) {
+ public TxchainDomWrite(final DOMDataBroker domDataBroker, final StartTestInput.Operation oper,
+ final int outerListElem, final int innerListElem, final long writesPerTx, final DataStore dataStore) {
super(oper, outerListElem, innerListElem, writesPerTx, dataStore);
this.domDataBroker = domDataBroker;
LOG.debug("Created TxchainDomWrite");
}
@Override
- public void onFailure(final Throwable t) {
- LOG.error("Transaction failed, {}", t);
+ public void onFailure(final Throwable cause) {
+ LOG.error("Transaction failed", cause);
txError++;
}
}, MoreExecutors.directExecutor());
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationseverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
protected final int iterations;
protected final Ntfbench ntf;
+ protected int ntfOk = 0;
+ protected int ntfError = 0;
+
/**
+ * Return number of successful notifications.
+ *
* @return the ntfOk
*/
public int getNtfOk() {
}
/**
+ * Return number of unsuccessful notifications.
+ *
* @return the ntfError
*/
public int getNtfError() {
return ntfError;
}
- protected int ntfOk = 0;
- protected int ntfError = 0;
-
public AbstractNtfbenchProducer(final NotificationPublishService publishService, final int iterations,
final int payloadSize) {
this.publishService = publishService;
}
@Override
+ @SuppressWarnings("checkstyle:illegalCatch")
public void run() {
int ntfOk = 0;
int ntfError = 0;
@Override
+ @SuppressWarnings("checkstyle:illegalCatch")
public void run() {
int ntfOk = 0;
int ntfError = 0;
* 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 ntfbenchmark.impl;
+import com.google.common.util.concurrent.Futures;
import java.util.concurrent.Future;
-
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.NtfbenchPayloadListener;
-import com.google.common.util.concurrent.Futures;
-
public class NtfbenchTestListener implements NtfbenchPayloadListener {
private final int expectedSize;
public Future<?> getAllDone() {
return Futures.immediateFuture(null);
}
-
}
* 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 ntfbenchmark.impl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
-
import com.google.common.util.concurrent.SettableFuture;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbench.payload.rev150709.Ntfbench;
public class NtfbenchWTCListener extends NtfbenchTestListener {
private final int expectedCount;
}
}
+ @Override
public SettableFuture<?> getAllDone() {
return allDone;
}
import org.slf4j.LoggerFactory;
public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService {
-
private static final Logger LOG = LoggerFactory.getLogger(NtfbenchmarkProvider.class);
+ private static final int TEST_TIMEOUT = 5;
+
private final NotificationService listenService;
private final NotificationPublishService publishService;
- private static final int testTimeout = 5;
public NtfbenchmarkProvider(final NotificationService listenServiceDependency,
final NotificationPublishService publishServiceDependency) {
}
executor.shutdown();
try {
- executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
+ executor.awaitTermination(TEST_TIMEOUT, TimeUnit.MINUTES);
for (ListenerRegistration<NtfbenchTestListener> listenerRegistration : listeners) {
listenerRegistration.getInstance().getAllDone().get();
}
} catch (final InterruptedException | ExecutionException 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);
}
final long producerEndTime = System.nanoTime();
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationseverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>