import org.slf4j.LoggerFactory;
public abstract class AbstractConfigTestBase {
-
private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
- public static final String ORG_OPS4J_PAX_LOGGING_CFG = "etc/org.ops4j.pax.logging.cfg";
- public static final String CUSTOM_PROPERTIES = "etc/custom.properties";
- private static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
- private static final String SERVER_PORT = "ovsdbserver.port";
- private static final String CONNECTION_TYPE = "ovsdbserver.connection";
- private static final String CONNECTION_TYPE_ACTIVE = "active";
- private static final String CONNECTION_TYPE_PASSIVE = "passive";
- private static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
- private static final String DEFAULT_SERVER_PORT = "6640";
/*
* Wait up to 10s for our configured module to come up
public Option[] getLoggingOptions() {
Option[] options = new Option[] {
- editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
logConfiguration(AbstractConfigTestBase.class),
- LogLevel.INFO.name()),
- editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
- "log4j.logger.org.opendaylight.ovsdb.southbound-impl",
- LogLevel.DEBUG.name())
+ LogLevel.INFO.name())
};
return options;
}
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
import com.google.common.base.Optional;
+import com.google.common.collect.ObjectArrays;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.MavenUrlReference;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerClass;
@ExamReactorStrategy(PerClass.class)
public class SouthboundIT extends AbstractMdsalTestBase {
private static final Logger LOG = LoggerFactory.getLogger(SouthboundIT.class);
- private static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
- private static final String SERVER_PORT = "ovsdbserver.port";
- private static final String CONNECTION_TYPE = "ovsdbserver.connection";
- private static final String CONNECTION_TYPE_ACTIVE = "active";
- private static final String CONNECTION_TYPE_PASSIVE = "passive";
- private static final int CONNECTION_INIT_TIMEOUT = 10000;
- private static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
- private static final String DEFAULT_SERVER_PORT = "6640";
private static Boolean writeStatus = false;
private static Boolean readStatus = false;
private static Boolean deleteStatus = false;
+ "passive connection : mvn -Dovsdbserver.connection=passive verify\n";
}
+ @Override
+ public Option[] getLoggingOptions() {
+ Option[] options = new Option[] {
+ editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+ "log4j.logger.org.opendaylight.ovsdb.southbound-impl",
+ LogLevelOption.LogLevel.DEBUG.name())
+ };
+ options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
+ return options;
+ }
+
@Override
public Option[] getPropertiesOptions() {
Properties props = new Properties(System.getProperties());
- String addressStr = props.getProperty(SERVER_IPADDRESS, DEFAULT_SERVER_IPADDRESS);
- String portStr = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
- String connectionType = props.getProperty(CONNECTION_TYPE, CONNECTION_TYPE_ACTIVE);
+ String addressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS,
+ SouthboundITConstants.DEFAULT_SERVER_IPADDRESS);
+ String portStr = props.getProperty(SouthboundITConstants.SERVER_PORT,
+ SouthboundITConstants.DEFAULT_SERVER_PORT);
+ String connectionType = props.getProperty(SouthboundITConstants.CONNECTION_TYPE,
+ SouthboundITConstants.CONNECTION_TYPE_ACTIVE);
LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
connectionType, addressStr, portStr);
Option[] options = new Option[] {
- editConfigurationFilePut(CUSTOM_PROPERTIES, SERVER_IPADDRESS, addressStr),
- editConfigurationFilePut(CUSTOM_PROPERTIES, SERVER_PORT, portStr),
- editConfigurationFilePut(CUSTOM_PROPERTIES, CONNECTION_TYPE, connectionType)
+ editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+ SouthboundITConstants.SERVER_IPADDRESS, addressStr),
+ editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+ SouthboundITConstants.SERVER_PORT, portStr),
+ editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
+ SouthboundITConstants.CONNECTION_TYPE, connectionType)
};
return options;
}
dataBroker = SouthboundProvider.getDb();
Assert.assertNotNull("db should not be null", dataBroker);
- addressStr = bc.getProperty(SERVER_IPADDRESS);
- portStr = bc.getProperty(SERVER_PORT);
- connectionType = bc.getProperty(CONNECTION_TYPE);
+ addressStr = bc.getProperty(SouthboundITConstants.SERVER_IPADDRESS);
+ portStr = bc.getProperty(SouthboundITConstants.SERVER_PORT);
+ connectionType = bc.getProperty(SouthboundITConstants.CONNECTION_TYPE);
LOG.info("Using the following properties: mode= {}, ip:port= {}:{}",
connectionType, addressStr, portStr);
- if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_ACTIVE)) {
+ if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_ACTIVE)) {
if (addressStr == null) {
fail(usage());
}
@Test
public void testPassiveNode() throws InterruptedException {
- if (connectionType.equalsIgnoreCase(CONNECTION_TYPE_PASSIVE)) {
+ if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_PASSIVE)) {
//Wait for CONNECTION_INIT_TIMEOUT for the Passive connection to be initiated by the ovsdb-server.
- Thread.sleep(CONNECTION_INIT_TIMEOUT);
+ Thread.sleep(SouthboundITConstants.CONNECTION_INIT_TIMEOUT);
}
}
--- /dev/null
+/*
+ * Copyright (c) 2015 Red Hat, 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.ovsdb.southbound.it;
+
+/**
+ * Constants for SouthboundIT
+ */
+public final class SouthboundITConstants {
+ private SouthboundITConstants() {
+ throw new AssertionError("This class should not be instantiated.");
+ }
+
+ public static final String ORG_OPS4J_PAX_LOGGING_CFG = "etc/org.ops4j.pax.logging.cfg";
+ public static final String CUSTOM_PROPERTIES = "etc/custom.properties";
+ public static final String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
+ public static final String SERVER_PORT = "ovsdbserver.port";
+ public static final String SERVER_EXTRAS = "ovsdbserver.extras";
+ public static final String CONNECTION_TYPE = "ovsdbserver.connection";
+ public static final String CONNECTION_TYPE_ACTIVE = "active";
+ public static final String CONNECTION_TYPE_PASSIVE = "passive";
+ public static final int CONNECTION_INIT_TIMEOUT = 10000;
+ public static final String DEFAULT_SERVER_IPADDRESS = "127.0.0.1";
+ public static final String DEFAULT_SERVER_PORT = "6640";
+ public static final String DEFAULT_SERVER_EXTRAS = "false";
+}