mirror of https://github.com/apache/activemq.git
validate shared file system master/slave with single shared brokerurl
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@790929 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6a121b33ed
commit
00bb52bcde
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.activemq.broker.ft;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.broker.TransportConnector;
|
||||
|
||||
|
||||
public class QueueMasterSlaveSingleUrlTest extends QueueMasterSlaveTest {
|
||||
private final String brokerUrl = "tcp://localhost:62001";
|
||||
private final String singleUriString = "failover://(" + brokerUrl +")?randomize=false";
|
||||
|
||||
protected ActiveMQConnectionFactory createConnectionFactory() throws Exception {
|
||||
return new ActiveMQConnectionFactory(singleUriString);
|
||||
}
|
||||
|
||||
protected void createMaster() throws Exception {
|
||||
master = new BrokerService();
|
||||
master.setBrokerName("shared");
|
||||
master.addConnector(brokerUrl);
|
||||
master.start();
|
||||
}
|
||||
|
||||
protected void createSlave() throws Exception {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
BrokerService broker = new BrokerService();
|
||||
broker.setBrokerName("shared");
|
||||
// add transport as a service so that it is bound on start, after store started
|
||||
final TransportConnector tConnector = new TransportConnector();
|
||||
tConnector.setUri(new URI(brokerUrl));
|
||||
broker.addConnector(tConnector);
|
||||
|
||||
broker.start();
|
||||
slave.set(broker);
|
||||
slaveStarted.countDown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue