- Timestamp:
- 06/21/13 12:42:25 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 deleted
- 15 edited
- 5 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/pom.xml
r52 r54 70 70 <sourceDirectory>src</sourceDirectory> 71 71 <testSourceDirectory>test</testSourceDirectory> 72 <resources> 73 <resource> 74 <directory>src/main/resources</directory> 75 <filtering>true</filtering> 76 <includes> 77 <include>log4j.xml</include> 78 <include>example.properties</include> 79 <include>version.properties</include> 80 </includes> 81 </resource> 82 </resources> 72 83 <plugins> 73 84 <plugin> -
trunk/src/main/java/omq/client/listener/ResponseListener.java
r53 r54 55 55 @Override 56 56 public void run() { 57 logger.info("ResponseListener started"); 57 58 Delivery delivery; 58 59 String uid_request; … … 122 123 123 124 channel.queueDeclare(reply_queue, durable, false, false, args); 125 logger.info("ResponseListener creating queue: " + reply_queue + ", durable: " + durable); 124 126 125 127 // Declare a new consumer -
trunk/src/main/java/omq/client/proxy/Proxymq.java
r53 r54 15 15 import omq.Remote; 16 16 import omq.client.annotation.AsyncMethod; 17 import omq.client.annotation.MultiMethod; 17 18 import omq.client.annotation.SyncMethod; 18 19 import omq.client.listener.ResponseListener; … … 133 134 Request request = createRequest(method, arguments); 134 135 135 // Log.saveTimeSendRequestLog("Client-time-request", request.getId(),136 // method.getName(), timeStart);137 138 136 Object response = null; 139 137 // Publish the request … … 144 142 logger.debug("Publish sync request -> " + request.getId()); 145 143 response = publishSyncRequest(request, method.getReturnType()); 146 147 // long timeEnd = (new Date()).getTime();148 // Log.saveTimeSendRequestLog("Client-time-response",149 // request.getId(), method.getName(), timeEnd);150 144 } 151 145 … … 168 162 // channel.basicPublish(exchange, routingkey, props, bytesRequest); 169 163 broker.getChannel().basicPublish(exchange, routingkey, props, bytesRequest); 170 // Log.saveLog("Client-Serialize", bytesRequest);171 164 } 172 165 … … 203 196 String corrId = java.util.UUID.randomUUID().toString(); 204 197 String methodName = method.getName(); 198 boolean multi = false; 199 200 if (method.getAnnotation(MultiMethod.class) != null) { 201 multi = true; 202 } 205 203 206 204 // Since we need to know whether the method is async and if it has to … … 217 215 return Request.newSyncRequest(corrId, methodName, arguments, retries, timeout); 218 216 } else { 219 return Request.newAsyncRequest(corrId, methodName, arguments );217 return Request.newAsyncRequest(corrId, methodName, arguments, multi); 220 218 } 221 219 } … … 237 235 } 238 236 resp = serializer.deserializeResponse(results.get(corrId), type); 239 // Log.saveLog("Client-Deserialize", results.get(corrId));240 237 241 238 // Remove and indicate the key exists (a hashmap can contain a null -
trunk/src/main/java/omq/common/broker/Broker.java
r53 r54 176 176 if (responseListener == null) { 177 177 responseListener = new ResponseListener(this); 178 responseListener.start(); 178 179 } 179 180 if (eventDispatcher == null) { 180 181 eventDispatcher = new EventDispatcher(this); 182 eventDispatcher.start(); 181 183 } 182 184 } … … 197 199 byte[] bytesResponse = serializer.serialize(wrapper); 198 200 channel.basicPublish(UID, "", null, bytesResponse); 199 200 // Log.saveLog("Server-Serialize", bytesResponse);201 201 } 202 202 -
trunk/src/main/java/omq/common/event/EventDispatcher.java
r53 r54 56 56 boolean durable = Boolean.parseBoolean(env.getProperty(ParameterQueue.DURABLE_QUEUES, "false")); 57 57 channel.queueDeclare(event_queue, durable, false, false, null); 58 logger.info("EventDispatcher creating queue: " + event_queue + ", durable: " + durable); 58 59 59 60 // Declare a new consumer … … 72 73 @Override 73 74 public void run() { 75 logger.info("EventDispatcher started"); 74 76 Delivery delivery; 75 77 Event event; … … 84 86 85 87 logger.info("Event received -> Topic: " + event.getTopic() + "CorrId: " + event.getCorrId()); 86 // Log.saveLog("Client-Deserialize", delivery.getBody());87 88 // long timeEnd = (new Date()).getTime();89 // Log.saveTimeSendRequestLog("Client-time-response",90 // event.getCorrId(), "Event!", timeEnd);91 88 92 89 // Dispatch it -
trunk/src/main/java/omq/common/message/Request.java
r44 r54 15 15 private boolean async = false; 16 16 17 private transient boolean multi; 17 18 private transient long timeout; 18 19 private transient int retries; … … 34 35 } 35 36 37 public Request(String id2, String method2, boolean b, Object[] params2, boolean multi2) { 38 // TODO Auto-generated constructor stub 39 } 40 36 41 public static Request newSyncRequest(String id, String method, Object[] params) { 37 42 return new Request(id, method, false, params); … … 45 50 } 46 51 47 public static Request newAsyncRequest(String id, String method, Object[] params ) {48 return new Request(id, method, true, params );52 public static Request newAsyncRequest(String id, String method, Object[] params, boolean multi) { 53 return new Request(id, method, true, params, multi); 49 54 } 50 55 … … 97 102 } 98 103 104 public boolean isMulti() { 105 return multi; 106 } 107 108 public void setMulti(boolean multi) { 109 this.multi = multi; 110 } 99 111 } -
trunk/src/main/java/omq/server/InvocationThread.java
r53 r54 44 44 // Deserialize the json 45 45 Request request = serializer.deserializeRequest(serializerType, delivery.getBody(), obj); 46 // Log.saveLog("Server-Deserialize", delivery.getBody());47 48 46 String methodName = request.getMethod(); 49 47 String requestID = request.getId(); … … 77 75 byte[] bytesResponse = serializer.serialize(serializerType, resp); 78 76 channel.basicPublish("", props.getReplyTo(), replyProps, bytesResponse); 79 80 // Log.saveLog("Server-Serialize", bytesResponse);77 logger.debug("Publish sync response -> Object: " + obj.getRef() + ", method: " + methodName + " corrID: " + requestID + " replyTo: " 78 + props.getReplyTo()); 81 79 } 82 80 -
trunk/src/main/java/omq/server/RemoteObject.java
r53 r54 35 35 36 36 private static final long serialVersionUID = -1778953938739846450L; 37 private static final String multi = "multi#"; 37 38 private static final Logger logger = Logger.getLogger(RemoteObject.class.getName()); 38 39 … … 230 231 logger.info("RemoteObject: " + UID + " declaring direct exchange: " + exchange + ", Queue: " + queue); 231 232 channel.exchangeDeclare(exchange, "direct"); 233 channel.exchangeDeclare(multi + exchange, "fanout"); 232 234 channel.queueDeclare(queue, durable, false, false, null); 233 235 channel.queueBind(queue, exchange, routingKey); 236 channel.queueBind(queue, multi + exchange, routingKey); 234 237 235 238 // Declare the event topic fanout -
trunk/src/main/resources/log4j.xml
r49 r54 6 6 <param name="Threshold" value="DEBUG" /> 7 7 <layout class="org.apache.log4j.PatternLayout"> 8 <param name="ConversionPattern" value="%d{[yyyy-MM-dd HH:mm:ss]} %-5p %c {1}:%L - %m%n" />8 <param name="ConversionPattern" value="%d{[yyyy-MM-dd HH:mm:ss]} %-5p %c:%L - %m%n" /> 9 9 </layout> 10 10 </appender> … … 25 25 26 26 <layout class="org.apache.log4j.PatternLayout"> 27 <param value="%d{[yyyy-MM-dd HH:mm:ss]} %-5p %c {1}:%L - %m%n" name="ConversionPattern"/>27 <param value="%d{[yyyy-MM-dd HH:mm:ss]} %-5p %c:%L - %m%n" name="ConversionPattern"/> 28 28 </layout> 29 29 </appender> -
trunk/src/test/java/omq/test/calculator/CalculatorImpl.java
r46 r54 3 3 import java.io.IOException; 4 4 5 import omq.common.broker.Broker;6 5 import omq.exception.SerializerException; 7 6 import omq.server.RemoteObject; … … 36 35 @Override 37 36 public void asyncDivideByZero() throws IOException, SerializerException { 38 ZeroEvent ze = new ZeroEvent("my zero event", "zero-event");39 Broker.trigger(ze);40 // notifyEvent(ze);37 // ZeroEvent ze = new ZeroEvent("my zero event", "zero-event"); 38 // Broker.trigger(ze); 39 // notifyEvent(ze); 41 40 } 42 41 43 42 @Override 44 43 public void sendMessage(Message m) { 45 System.out.println("Code = " +m.getCode());46 System.out.println("Message = " +m.getMessage());44 System.out.println("Code = " + m.getCode()); 45 System.out.println("Message = " + m.getMessage()); 47 46 } 48 47 -
trunk/src/test/java/omq/test/calculator/CalculatorTest.java
r51 r54 12 12 13 13 import org.junit.After; 14 import org.junit.BeforeClass; 14 15 import org.junit.Test; 15 16 import org.junit.runner.RunWith; … … 18 19 19 20 @RunWith(value = Parameterized.class) 20 public class C lientTest {21 public class CalculatorTest { 21 22 23 private static Broker broker; 22 24 private static Calculator remoteCalc; 23 25 private static Calculator remoteCalc2; 24 26 25 public C lientTest(String type) throws Exception {27 public CalculatorTest(String type) throws Exception { 26 28 Properties env = new Properties(); 27 29 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 44 46 env.setProperty(ParameterQueue.EVENT_REPLY_QUEUE, "event_queue"); 45 47 46 Broker.initBroker(env);47 remoteCalc = (Calculator) Broker.lookup("calculator1", Calculator.class);48 remoteCalc2 = (Calculator) Broker.lookup("calculator2", Calculator.class);48 broker = new Broker(env); 49 remoteCalc = broker.lookup("calculator1", Calculator.class); 50 remoteCalc2 = broker.lookup("calculator2", Calculator.class); 49 51 } 50 52 … … 55 57 } 56 58 59 @BeforeClass 60 public static void server() throws Exception { 61 Properties env = new Properties(); 62 env.setProperty(ParameterQueue.USER_NAME, "guest"); 63 env.setProperty(ParameterQueue.USER_PASS, "guest"); 64 65 // Get host info of rabbimq (where it is) 66 env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); 67 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 68 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 69 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 70 71 // Set info about where the message will be sent 72 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 73 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 74 75 CalculatorImpl calc = new CalculatorImpl(); 76 CalculatorImpl calc2 = new CalculatorImpl(); 77 78 Broker broker = new Broker(env); 79 broker.bind("calculator1", calc); 80 broker.bind("calculator2", calc2); 81 82 System.out.println("Server started"); 83 } 84 57 85 @After 58 86 public void stop() throws Exception { 59 Broker.stopBroker();87 broker.stopBroker(); 60 88 } 61 89 -
trunk/src/test/java/omq/test/exception/ExceptionTest.java
r47 r54 13 13 14 14 import org.junit.After; 15 import org.junit.BeforeClass; 15 16 import org.junit.Test; 16 17 import org.junit.runner.RunWith; … … 19 20 20 21 @RunWith(value = Parameterized.class) 21 public class ClientTest { 22 private ClientInterface client; 22 public class ExceptionTest { 23 private static Broker broker; 24 private static ClientInterface client; 23 25 24 public ClientTest(String type) throws Exception {26 public ExceptionTest(String type) throws Exception { 25 27 Properties env = new Properties(); 26 28 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 42 44 env.setProperty(ParameterQueue.EVENT_REPLY_QUEUE, "event_queue"); 43 45 44 Broker.initBroker(env);45 client = (ClientInterface) Broker.lookup("server", ClientInterface.class);46 broker = new Broker(env); 47 client = broker.lookup("server", ClientInterface.class); 46 48 } 47 49 … … 52 54 } 53 55 56 @BeforeClass 57 public static void serverTest() throws Exception { 58 Properties env = new Properties(); 59 env.setProperty(ParameterQueue.USER_NAME, "guest"); 60 env.setProperty(ParameterQueue.USER_PASS, "guest"); 61 62 // Get host info of rabbimq (where it is) 63 env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); 64 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 65 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 66 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 67 68 // Set info about where the message will be sent 69 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 70 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 71 72 OmqServerImpl server = new OmqServerImpl(); 73 74 Broker broker = new Broker(env); 75 broker.bind("server", server); 76 } 77 54 78 @After 55 79 public void stop() throws Exception { 56 Broker.stopBroker();80 broker.stopBroker(); 57 81 } 58 82 -
trunk/src/test/java/omq/test/exception/ServerTest.java
r47 r54 28 28 OmqServerImpl server = new OmqServerImpl(); 29 29 30 Broker .initBroker(env);31 Broker.bind("server", server);30 Broker broker = new Broker(env); 31 broker.bind("server", server); 32 32 33 33 Thread.sleep(60 * 60 * 1000); 34 34 } 35 35 } 36 ; -
trunk/src/test/java/omq/test/faultTolerance/FaultToleranceTest.java
r46 r54 3 3 import static org.junit.Assert.assertEquals; 4 4 5 import java.util.Arrays; 6 import java.util.Collection; 5 7 import java.util.Properties; 6 8 … … 9 11 import omq.common.util.Serializer; 10 12 import omq.test.calculator.Calculator; 13 import omq.test.calculator.CalculatorImpl; 11 14 15 import org.junit.After; 12 16 import org.junit.BeforeClass; 13 17 import org.junit.Test; 18 import org.junit.runner.RunWith; 19 import org.junit.runners.Parameterized; 20 import org.junit.runners.Parameterized.Parameters; 14 21 15 16 public class ClientTest { 22 @RunWith(value = Parameterized.class) 23 public class FaultToleranceTest { 24 private static Broker broker; 17 25 private static Calculator remoteCalc; 18 26 19 @BeforeClass 20 public static void startClient() throws Exception { 27 public FaultToleranceTest(String type) throws Exception { 21 28 Properties env = new Properties(); 22 29 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 27 34 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 28 35 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 29 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);36 env.setProperty(ParameterQueue.SERIALIZER_NAME, type); 30 37 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 31 38 … … 40 47 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "5000"); 41 48 42 Broker.initBroker(env); 43 remoteCalc = (Calculator) Broker.lookup("calculator1", Calculator.class); 49 broker = new Broker(env); 50 remoteCalc = broker.lookup("calculator1", Calculator.class); 51 } 52 53 @Parameters 54 public static Collection<Object[]> data() { 55 Object[][] data = new Object[][] { { Serializer.java }, { Serializer.gson }, { Serializer.kryo } }; 56 return Arrays.asList(data); 57 } 58 59 @After 60 public void stop() throws Exception { 61 broker.stopBroker(); 62 } 63 64 @BeforeClass 65 public static void serverTest() throws Exception { 66 Properties env = new Properties(); 67 env.setProperty(ParameterQueue.USER_NAME, "guest"); 68 env.setProperty(ParameterQueue.USER_PASS, "guest"); 69 70 // Get host info of rabbimq (where it is) 71 env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); 72 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 73 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 74 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 75 76 // Set info about where the message will be sent 77 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 78 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 79 80 CalculatorImpl calc = new CalculatorImpl(); 81 82 broker = new Broker(env); 83 broker.bind("calculator1", calc); 84 85 System.out.println("Server started"); 44 86 } 45 87 -
trunk/src/test/java/omq/test/multiProcess/MultiProcessTest.java
r48 r54 12 12 13 13 import org.junit.After; 14 import org.junit.BeforeClass; 14 15 import org.junit.Test; 15 16 import org.junit.runner.RunWith; … … 18 19 19 20 @RunWith(value = Parameterized.class) 20 public class ClientTest {21 // Execute ServerTest.java 2 times before start this test22 public Number remoteNumber;21 public class MultiProcessTest { 22 public static Broker broker; 23 public static Number remoteNumber; 23 24 24 public ClientTest(String type) throws Exception {25 public MultiProcessTest(String type) throws Exception { 25 26 Properties env = new Properties(); 26 27 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 42 43 env.setProperty(ParameterQueue.EVENT_REPLY_QUEUE, "event_queue"); 43 44 44 Broker.initBroker(env);45 remoteNumber = Broker.lookup("number", Number.class);45 broker = new Broker(env); 46 remoteNumber = broker.lookup("number", Number.class); 46 47 } 47 48 … … 52 53 } 53 54 55 @BeforeClass 56 public static void serverTest() throws Exception { 57 Properties env = new Properties(); 58 env.setProperty(ParameterQueue.USER_NAME, "guest"); 59 env.setProperty(ParameterQueue.USER_PASS, "guest"); 60 61 // Get host info of rabbimq (where it is) 62 env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); 63 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 64 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 65 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 66 67 // Set info about where the message will be sent 68 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 69 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 70 71 Broker broker = new Broker(env); 72 broker.bind("number", new NumberImpl()); 73 74 Broker broker2 = new Broker(env); 75 broker2.bind("number", new NumberImpl()); 76 } 77 54 78 @After 55 79 public void stop() throws Exception { 56 Broker.stopBroker();80 broker.stopBroker(); 57 81 } 58 82 59 83 @Test 60 public void test() {84 public void fifoTest() { 61 85 int x = 10; 62 86 remoteNumber.setNumber(x); … … 68 92 } 69 93 94 @Test 95 public void multiTest() throws Exception { 96 int x = 10; 97 remoteNumber.setMultiNumber(x); 98 Thread.sleep(200); 99 int a = remoteNumber.getNumer(); 100 assertEquals(x, a); 101 remoteNumber.setMultiNumber(0); 102 Thread.sleep(200); 103 } 104 70 105 } -
trunk/src/test/java/omq/test/multiProcess/Number.java
r46 r54 2 2 3 3 import omq.Remote; 4 import omq.client.annotation.AsyncMethod; 5 import omq.client.annotation.MultiMethod; 4 6 import omq.client.annotation.RemoteInterface; 5 7 import omq.client.annotation.SyncMethod; … … 12 14 @SyncMethod(timeout = 1000) 13 15 public int getNumer(); 16 17 @MultiMethod 18 @AsyncMethod 19 public void setMultiNumber(int x); 14 20 } -
trunk/src/test/java/omq/test/multiProcess/NumberImpl.java
r46 r54 1 1 package omq.test.multiProcess; 2 2 3 import omq.client.annotation.AsyncMethod; 4 import omq.client.annotation.MultiMethod; 3 5 import omq.client.annotation.SyncMethod; 4 6 import omq.server.RemoteObject; … … 30 32 } 31 33 34 @Override 35 @MultiMethod 36 @AsyncMethod 37 public void setMultiNumber(int x) { 38 this.x = x; 39 } 40 32 41 } -
trunk/src/test/java/omq/test/stopBroker/BrokerKillerImpl.java
r46 r54 12 12 private static final long serialVersionUID = 1L; 13 13 14 private Broker broker; 15 16 public BrokerKillerImpl(Broker broker) { 17 this.broker = broker; 18 } 19 14 20 @Override 15 21 @AsyncMethod … … 24 30 try { 25 31 Thread.sleep(1000); 26 Broker.stopBroker();32 broker.stopBroker(); 27 33 } catch (Exception e) { 28 34 e.printStackTrace(); -
trunk/src/test/java/omq/test/stopBroker/StopBrokerTest.java
r46 r54 1 1 package omq.test.stopBroker; 2 2 3 import java.util.Arrays; 4 import java.util.Collection; 3 5 import java.util.Properties; 4 6 … … 7 9 import omq.common.util.Serializer; 8 10 9 public class ClientTest { 11 import org.junit.After; 12 import org.junit.BeforeClass; 13 import org.junit.Test; 14 import org.junit.runner.RunWith; 15 import org.junit.runners.Parameterized; 16 import org.junit.runners.Parameterized.Parameters; 10 17 11 /** 12 * @param args 13 * @throws Exception 14 */ 15 public static void main(String[] args) throws Exception { 18 @RunWith(value = Parameterized.class) 19 public class StopBrokerTest { 20 21 private static Broker broker; 22 private static BrokerKiller bk; 23 24 public StopBrokerTest(String type) throws Exception { 16 25 Properties env = new Properties(); 17 26 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 22 31 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 23 32 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 24 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);33 env.setProperty(ParameterQueue.SERIALIZER_NAME, type); 25 34 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 26 35 … … 35 44 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "5000"); 36 45 37 Broker.initBroker(env); 38 BrokerKiller bk = (BrokerKiller) Broker.lookup("bk", BrokerKiller.class); 46 broker = new Broker(env); 47 bk = broker.lookup("bk", BrokerKiller.class); 48 } 39 49 50 @Parameters 51 public static Collection<Object[]> data() { 52 Object[][] data = new Object[][] { { Serializer.java }, { Serializer.gson }, { Serializer.kryo } }; 53 return Arrays.asList(data); 54 } 55 56 @BeforeClass 57 public static void server() throws Exception { 58 Properties env = new Properties(); 59 env.setProperty(ParameterQueue.USER_NAME, "guest"); 60 env.setProperty(ParameterQueue.USER_PASS, "guest"); 61 62 // Get host info of rabbimq (where it is) 63 env.setProperty(ParameterQueue.SERVER_HOST, "127.0.0.1"); 64 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 65 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 66 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 67 68 // Set info about where the message will be sent 69 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 70 env.setProperty(ParameterQueue.RETRY_TIME_CONNECTION, "2000"); 71 72 Broker broker = new Broker(env); 73 BrokerKillerImpl bki = new BrokerKillerImpl(broker); 74 broker.bind("bk", bki); 75 } 76 77 @After 78 public void stop() throws Exception { 79 broker.stopBroker(); 80 } 81 82 @Test 83 public void stopBroker() throws Exception { 40 84 bk.killServerBroker(); 41 Broker.stopBroker();42 85 } 43 86 -
trunk/src/test/java/omq/test/stopBroker/UnbindTest.java
r46 r54 5 5 import omq.common.broker.Broker; 6 6 import omq.common.util.ParameterQueue; 7 import omq.common.util.Serializer;8 7 import omq.test.calculator.CalculatorImpl; 9 8 9 import org.junit.Test; 10 10 11 public class UnbindTest { 11 private static CalculatorImpl calc;12 12 13 /** 14 * @param args 15 */ 16 public static void main(String[] args) throws Exception { 13 @Test 14 public void serverTest() throws Exception { 17 15 Properties env = new Properties(); 18 16 env.setProperty(ParameterQueue.USER_NAME, "guest"); … … 23 21 env.setProperty(ParameterQueue.SERVER_PORT, "5672"); 24 22 env.setProperty(ParameterQueue.DURABLE_QUEUES, "false"); 25 env.setProperty(ParameterQueue.SERIALIZER_NAME, Serializer.java);26 23 env.setProperty(ParameterQueue.ENABLECOMPRESSION, "false"); 27 24 … … 31 28 32 29 String reference = "calculator1"; 33 calc = new CalculatorImpl();30 CalculatorImpl calc = new CalculatorImpl(); 34 31 35 Broker .initBroker(env);36 Broker.bind(reference, calc);32 Broker broker = new Broker(env); 33 broker.bind(reference, calc); 37 34 38 Broker.unbind(reference);35 broker.unbind(reference); 39 36 40 Broker.closeConnection();37 broker.closeConnection(); 41 38 } 42 39
Note: See TracChangeset
for help on using the changeset viewer.