Beispiel #1
0
 /**
  * Rigorous Test :-)
  *
  * @throws IOException
  */
 @Test
 public void testInstanceProp() throws IOException {
   App app = App.instance();
   Notify notify = app.getNotify("/notify/test");
   notify.replaceProperty("a".getBytes(), "I Love it.".getBytes());
   byte[] v = notify.getProperty("a".getBytes());
   System.out.println(new String(v));
 }
Beispiel #2
0
 @Test
 public void testGetNotify() throws Exception {
   Notify notify1 = APP.getNotify("/notify/test");
   Notify notify2 = APP.getNotify("/notify/test/tmp");
   Notify notify3 = APP.getNotify(new String("/notify/test/tmp"));
   assertNotEquals(notify1, notify2);
   assertEquals(notify3, notify2);
 }
Beispiel #3
0
 @Test(expected = NullPointerException.class)
 public void testClose() throws Exception {
   App app = new App(URL, 10000);
   app.notifyMap = null;
   try {
     app.getNotify("/notify/test");
   } finally {
     app.close();
   }
 }
Beispiel #4
0
 public static void setUp() {
   try {
     App.init(URL, 10000);
   } catch (IOException e) {
     throw new IllegalStateException("Failed to connect to ZK.", e);
   }
 }
Beispiel #5
0
 @Test
 public void test() {
   assertThat(App.sayHello(), is("Hello, world."));
 }
Beispiel #6
0
 @Test
 @Points("maven-exercise")
 public void trol() {
   App.main(null);
   assertTrue(true);
 }
 @Test
 public void testAnotherMethod() {
   App.doNothing();
 }
Beispiel #8
0
 @Test
 public void testSum() {
   int x = App.sum(1, 2);
   assertEquals(3, x);
 }
Beispiel #9
0
 @Test
 public void testInit() throws Exception {
   App.init("not yet implemented", 10000);
   assertEquals(APP, App.instance());
 }
Beispiel #10
0
 /**
  * Rigorous Test :-)
  *
  * @throws IOException
  */
 @Test
 public void testAppNull() throws IOException {
   App app = App.instance();
   Notify notify = app.getNotify("/notify/test/tmplevt");
   assertNull(notify);
 }
Beispiel #11
0
 public static void cleanZK(String base) {
   if (APP.exists(base)) {
     APP.deleteTree(base);
   }
   APP.makeSurePathExists(base);
 }
Beispiel #12
0
 static {
   setUp();
   APP = App.instance();
   cleanZK("/notify/test/tmp");
 }