Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
- Upgraded to junit 4.7, removed testng dependency.
Browse files Browse the repository at this point in the history
- adding log4j.properties for maven and ide testing.



git-svn-id: https://svn.apache.org/repos/asf/activemq/sandbox/activemq-apollo@830393 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
chirino committed Oct 27, 2009
1 parent 61ae9bc commit 80a5efe
Show file tree
Hide file tree
Showing 69 changed files with 2,007 additions and 550 deletions.
6 changes: 0 additions & 6 deletions activemq-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand Down
27 changes: 27 additions & 0 deletions activemq-all/src/test/ide-resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## ------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------

#
# The logging properties used for ide testing, We want to see
# info level output in the console.
#
log4j.rootLogger=WARN, console
log4j.logger.org.apache.activemq=INFO

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %m%n
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,50 @@
import java.io.IOException;
import java.net.URISyntaxException;

import org.apache.activemq.apollo.Combinator.BeanFactory;
import org.apache.activemq.openwire.BrokerTest;
import org.apache.activemq.openwire.BrokerTestScenario;
import org.apache.activemq.transport.TransportServer;

/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
public abstract class TransportBrokerTestSupport extends BrokerTest {

protected abstract String getBindLocation();
public static BeanFactory<BrokerTestScenario> transportScenerios(final String bindLocation) {
return transportScenerios(bindLocation, 4000);
}

public static BeanFactory<BrokerTestScenario> transportScenerios(final String bindLocation, final int maxWait) {
return new BeanFactory<BrokerTestScenario>() {
public BrokerTestScenario createBean() throws Exception {
BrokerTestScenario rc = new BrokerTestScenario() {
private TransportServer transnportServer;

/**
* Need to enhance the BrokerTestScenario a bit to inject the wire format
*/
@Override
public Object createBean() throws Exception {
BrokerTestScenario brokerTestScenario = new BrokerTestScenario() {

private TransportServer transnportServer;
@Override
public TransportServer createTransnportServer() throws IOException, URISyntaxException {
transnportServer = super.createTransnportServer();
return transnportServer;
}

@Override
public String getConnectURI() {
return transnportServer.getConnectURI().toString();
}

@Override
public TransportServer createTransnportServer() throws IOException, URISyntaxException {
transnportServer = super.createTransnportServer();
return transnportServer;
}

@Override
public String getConnectURI() {
return transnportServer.getConnectURI().toString();
}
@Override
public String getBindURI() {
return bindLocation;
}
};
rc.maxWait = maxWait;
return rc;
}

@Override
public String getBindURI() {
return getBindLocation();
}

};
return brokerTestScenario;
public Class<BrokerTestScenario> getBeanClass() {
return BrokerTestScenario.class;
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
package org.apache.activemq.legacy.transport.nio;

import org.apache.activemq.legacy.transport.TransportBrokerTestSupport;
import org.testng.annotations.Test;
import org.junit.BeforeClass;
import org.junit.experimental.theories.Theories;
import org.junit.runner.RunWith;

@Test
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@RunWith(Theories.class)
public class NIOTransportBrokerTest extends TransportBrokerTestSupport {

protected String getBindLocation() {
return "nio://localhost:0";
}

@BeforeClass
static public void createScenarios() throws Exception {
SCENARIOS = combinations().asBeans(transportScenerios("ssl://localhost:0"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@
import org.apache.activemq.apollo.broker.BrokerFactory;
import org.apache.activemq.legacy.transport.TransportBrokerTestSupport;
import org.apache.activemq.transport.TransportFactory;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.experimental.theories.Theories;
import org.junit.runner.RunWith;

/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@RunWith(Theories.class)
@Ignore
public class SslBrokerServiceTest extends TransportBrokerTestSupport {

protected String getBindLocation() {
return "ssl://localhost:0";
}
@BeforeClass
static public void createScenarios() throws Exception {
SCENARIOS = combinations().asBeans(transportScenerios("ssl://localhost:0"));
}

// @Override
// protected Broker createBroker() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,32 @@
package org.apache.activemq.legacy.transport.tcp;

import org.apache.activemq.legacy.transport.TransportBrokerTestSupport;
import org.apache.activemq.openwire.BrokerTestScenario;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.junit.BeforeClass;
import org.junit.experimental.theories.Theories;
import org.junit.runner.RunWith;

@Test
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@RunWith(Theories.class)
public class SslTransportBrokerTest extends TransportBrokerTestSupport {

public static final String KEYSTORE_TYPE = "jks";
public static final String PASSWORD = "password";
public static final String SERVER_KEYSTORE = "src/test/resources/server.keystore";
public static final String TRUST_KEYSTORE = "src/test/resources/client.keystore";

protected String getBindLocation() {
return "ssl://localhost:0";
}

@BeforeTest
protected void setUp() throws Exception {
@BeforeClass
static public void createScenarios() throws Exception {
System.setProperty("javax.net.ssl.trustStore", TRUST_KEYSTORE);
System.setProperty("javax.net.ssl.trustStorePassword", PASSWORD);
System.setProperty("javax.net.ssl.trustStoreType", KEYSTORE_TYPE);
System.setProperty("javax.net.ssl.keyStore", SERVER_KEYSTORE);
System.setProperty("javax.net.ssl.keyStorePassword", PASSWORD);
System.setProperty("javax.net.ssl.keyStoreType", KEYSTORE_TYPE);
//System.setProperty("javax.net.debug", "ssl,handshake,data,trustmanager");
}

@Override
public Object createBean() throws Exception {
BrokerTestScenario scenario = (BrokerTestScenario) super.createBean();
scenario.maxWait = 10000;
return scenario;
SCENARIOS = combinations().asBeans(transportScenerios("ssl://localhost:0", 10000));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@
package org.apache.activemq.legacy.transport.tcp;

import org.apache.activemq.legacy.transport.TransportBrokerTestSupport;
import org.apache.activemq.openwire.BrokerTestScenario;
import org.testng.annotations.Test;
import org.junit.BeforeClass;
import org.junit.experimental.theories.Theories;
import org.junit.runner.RunWith;

@Test
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@RunWith(Theories.class)
public class TcpTransportBrokerTest extends TransportBrokerTestSupport {

protected String getBindLocation() {
return "tcp://localhost:0";

@BeforeClass
static public void createScenarios() throws Exception {
SCENARIOS = combinations().asBeans(transportScenerios("tcp://localhost:0", 2000));
}

@Override
public Object createBean() throws Exception {
BrokerTestScenario scenario = (BrokerTestScenario) super.createBean();
scenario.maxWait = 2000;
return scenario;
}


}
26 changes: 13 additions & 13 deletions activemq-all/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
#
# The logging properties used during tests..
#
log4j.rootLogger=INFO, out, stdout
log4j.rootLogger=WARN, console, file
log4j.logger.org.apache.activemq=INFO

log4j.logger.org.apache.activemq.spring=WARN
# Console will only display warnnings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d | %-5p | %m%n
log4j.appender.console.threshold=WARN

# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n

# File appender
log4j.appender.out=org.apache.log4j.FileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
log4j.appender.out.file=target/activemq-test.log
log4j.appender.out.append=true
# File appender will contain all info messages
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
log4j.appender.file.file=target/test.log
log4j.appender.file.append=true
27 changes: 27 additions & 0 deletions activemq-bio/src/test/ide-resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## ------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------

#
# The logging properties used for ide testing, We want to see
# info level output in the console.
#
log4j.rootLogger=WARN, console
log4j.logger.org.apache.activemq=INFO

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %m%n
35 changes: 35 additions & 0 deletions activemq-bio/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## ---------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------

#
# The logging properties used during tests..
#
log4j.rootLogger=WARN, console, file
log4j.logger.org.apache.activemq=INFO

# Console will only display warnnings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d | %-5p | %m%n
log4j.appender.console.threshold=WARN

# File appender will contain all info messages
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d | %-5p | %m | %c | %t%n
log4j.appender.file.file=target/test.log
log4j.appender.file.append=true
6 changes: 0 additions & 6 deletions activemq-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
Expand Down
27 changes: 27 additions & 0 deletions activemq-broker/src/test/ide-resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## ------------------------------------------------------------------------
## Licensed to the Apache Software Foundation (ASF) under one or more
## contributor license agreements. See the NOTICE file distributed with
## this work for additional information regarding copyright ownership.
## The ASF licenses this file to You under the Apache License, Version 2.0
## (the "License"); you may not use this file except in compliance with
## the License. You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## ------------------------------------------------------------------------

#
# The logging properties used for ide testing, We want to see
# info level output in the console.
#
log4j.rootLogger=WARN, console
log4j.logger.org.apache.activemq=INFO

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %m%n
Loading

0 comments on commit 80a5efe

Please sign in to comment.