File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868 </dependencies >
6969 <build >
7070 <sourceDirectory >src</sourceDirectory >
71- <testSourceDirectory >test</testSourceDirectory >
71+ <!-- < testSourceDirectory>test</testSourceDirectory> -- >
7272 <resources >
7373 <resource >
7474 <directory >src/main/resources</directory >
108108 <manifest >
109109 <addClasspath >true</addClasspath >
110110 </manifest >
111- </archive >
111+ </archive >
112112 </configuration >
113113 </plugin >
114114 <plugin >
117117 <version >2.14.1</version >
118118 <configuration >
119119 <skipTests >true</skipTests >
120+ <excludes >
121+ <exclude >omq/test/*</exclude >
122+ </excludes >
120123 </configuration >
121124 </plugin >
122125 </plugins >
Original file line number Diff line number Diff line change @@ -51,6 +51,23 @@ public class Broker {
5151 private Map <String , Object > proxies = new Hashtable <String , Object >();
5252 private Map <String , Object > multiProxies = new Hashtable <String , Object >();
5353
54+ public Broker () throws Exception {
55+ Properties env = new Properties ();
56+
57+ remoteObjs = new HashMap <String , RemoteObject >();
58+ serializer = new Serializer (env );
59+ environment = env ;
60+ connection = OmqConnectionFactory .getNewConnection (env );
61+ channel = connection .createChannel ();
62+ addFaultTolerance ();
63+ if (!connection .isOpen () || !channel .isOpen ()) {
64+ if (connection .isOpen ()) {
65+ connection .close ();
66+ }
67+ throw new InitBrokerException ("The connection didn't work" );
68+ }
69+ }
70+
5471 public Broker (Properties env ) throws Exception {
5572 // Load log4j configuration
5673 // URL log4jResource = Broker.class.getResource("/log4j.xml");
Original file line number Diff line number Diff line change @@ -82,12 +82,12 @@ public static Connection getNewWorkingConnection(Properties env) throws Exceptio
8282 */
8383 public static Connection getNewConnection (Properties env ) throws IOException , KeyManagementException , NoSuchAlgorithmException {
8484 // Get login info of rabbitmq
85- String username = env .getProperty (ParameterQueue .USER_NAME );
86- String password = env .getProperty (ParameterQueue .USER_PASS );
85+ String username = env .getProperty (ParameterQueue .USER_NAME , ParameterQueue . DEFAULT_USER );
86+ String password = env .getProperty (ParameterQueue .USER_PASS , ParameterQueue . DEFAULT_PASS );
8787
8888 // Get host info of rabbimq (where it is)
89- String host = env .getProperty (ParameterQueue .RABBIT_HOST );
90- int port = Integer .parseInt (env .getProperty (ParameterQueue .RABBIT_PORT ));
89+ String host = env .getProperty (ParameterQueue .RABBIT_HOST , ParameterQueue . DEFAULT_RABBIT_HOST );
90+ int port = Integer .parseInt (env .getProperty (ParameterQueue .RABBIT_PORT , ParameterQueue . DEFAULT_PORT ));
9191
9292 boolean ssl = Boolean .parseBoolean (env .getProperty (ParameterQueue .ENABLE_SSL , "false" ));
9393
Original file line number Diff line number Diff line change @@ -141,4 +141,9 @@ public class ParameterQueue {
141141 */
142142 public static long DEFAULT_TIMEOUT = 1 * 1000 * 60 ;
143143
144+ public static String DEFAULT_USER = "guest" ;
145+ public static String DEFAULT_PASS = "guest" ;
146+ public static String DEFAULT_RABBIT_HOST = "localhost" ;
147+ public static String DEFAULT_PORT = "5672" ;
148+
144149}
You can’t perform that action at this time.
0 commit comments