Package org.apache.shindig.protocol

Examples of org.apache.shindig.protocol.RestHandler.execute()


    String path = "/cache/invalidate";
    RestHandler operation = registry.getRestHandler(path, "POST");
    params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"});

    try {
      operation.execute(params, null, token, converter).get();
      fail("Expected error");
    } catch (ExecutionException ee) {
      assertTrue(ee.getCause() instanceof ProtocolException);
    }
  }
View Full Code Here


    params.put(InvalidationHandler.KEYS_PARAM, new String[]{"http://www.example.org/gadget.xml"});

    try {
      token.setAppId("");
      token.setAppUrl("");
      operation.execute(params, null, token, converter).get();
      fail("Expected error");
    } catch (ExecutionException ee) {
      assertTrue(ee.getCause() instanceof ProtocolException);
    }
  }
View Full Code Here

    EasyMock.replay(messageService, converter);

    RestHandler operation = registry.getRestHandler("/messages/" + sender.getUserId() + "/@outbox", "POST");
    Map<String,String[]> params = ImmutableMap.of(RequestItem.APP_ID, new String[]{"messageHandlerTest"});

    operation.execute(params,null, token, converter).get();
    EasyMock.verify(converter, messageService);
  }
}
View Full Code Here

        eq(new GroupId(group, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));

    replay();
    assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
        null, token, converter).get());
    verify();
  }

  @Test
View Full Code Here

        eq(new GroupId(GroupId.Type.self, null)),
        eq("appId"), eq(ImmutableSet.<String>of()), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));

    replay();
    assertEquals(data, operation.execute(Maps.<String, String[]>newHashMap(),
        null, token, converter).get());
    verify();
  }

  @Test
View Full Code Here

        eq(new GroupId(GroupId.Type.friends, null)),
        eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
        .andReturn(ImmediateFuture.newInstance(data));

    replay();
    assertEquals(data, operation.execute(params, null, token, converter).get());
    verify();
  }

  private Future<?> setupPostData(String method) throws ProtocolException {
    String path = "/appdata/john.doe/@self/appId";
View Full Code Here

    org.easymock.EasyMock.expect(appDataService.updatePersonData(eq(JOHN_DOE.iterator().next()),
        eq(new GroupId(GroupId.Type.self, null)),
        eq("appId"), eq(ImmutableSet.of("pandas")), eq(values), eq(token)))
        .andReturn(ImmediateFuture.newInstance((Void) null));
    replay();
    return operation.execute(params, new StringReader(jsonAppData), token, converter);
  }

  @Test
  public void testHandlePost() throws Exception {
    assertNull(setupPostData("POST").get());
View Full Code Here

    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
        .andReturn(values);

    replay();
    try {
      operation.execute(params, new StringReader(jsonAppData), token, converter).get();
      fail();
    } catch (ExecutionException ee) {
      assertEquals(HttpServletResponse.SC_BAD_REQUEST,
          ((ProtocolException) ee.getCause()).getCode());
      // was expecting an Exception
View Full Code Here

    org.easymock.EasyMock.expect(converter.convertToObject(eq(jsonAppData), eq(Map.class)))
        .andReturn(values);

    replay();
    try {
      operation.execute(params, new StringReader(jsonAppData), token, converter).get();
      fail();
    } catch (ExecutionException ee) {
      assertEquals(HttpServletResponse.SC_BAD_REQUEST,
          ((ProtocolException) ee.getCause()).getCode());
    }
View Full Code Here

        eq(new GroupId(GroupId.Type.self, null)),
        eq("appId"), eq(ImmutableSet.of("pandas")), eq(token)))
        .andReturn(ImmediateFuture.newInstance((Void) null));

    replay();
    assertNull(operation.execute(params, null, token, converter).get());
    verify();
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.