Package com.google.wave.api.impl

Examples of com.google.wave.api.impl.EventMessageBundle


    when(wavelet.getId()).thenReturn(WAVELET_ID);

    EventDataConverterV21 converter = new EventDataConverterV21();
    assertEquals("",
        converter.toBlipData(conversation.getRootThread().getFirstBlip(), wavelet,
            new EventMessageBundle(null, null)).getContent());
  }
View Full Code Here


   * @param req the HTTP request.
   * @param resp the HTTP response.
   */
  private void processRpc(HttpServletRequest req, HttpServletResponse resp) {
    // Deserialize and process the incoming events.
    EventMessageBundle events = null;
    try {
      events = deserializeEvents(req);
    } catch (IOException e) {
      resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR);
      return;
    }

    // Append robot.notifyCapabilitiesHash operation before processing the
    // events.
    OperationQueue operationQueue = events.getWavelet().getOperationQueue();
    operationQueue.notifyRobotInformation(WaveService.PROTOCOL_VERSION, version);

    // Call the robot event handlers.
    processEvents(events);

View Full Code Here

   */
  private EventMessageBundle deserializeEvents(HttpServletRequest req) throws IOException {
    String json = readRequestBody(req);
    LOG.info("Incoming events: " + json);

    EventMessageBundle bundle = SERIALIZER.fromJson(json, EventMessageBundle.class);

    if (bundle.getRpcServerUrl() == null) {
      throw new IllegalArgumentException("RPC server URL is not set in the event bundle.");
    }

    if (!isUnsignedRequestsAllowed()) {
      if (!waveService.hasConsumerData(bundle.getRpcServerUrl())) {
        throw new IllegalArgumentException("No consumer key is found for the RPC server URL: " +
            bundle.getRpcServerUrl());
      }

      // Validates the request.
      try {
        @SuppressWarnings("unchecked")
        Map<String, String[]> parameterMap = req.getParameterMap();
        waveService.validateOAuthRequest(req.getRequestURL().toString(), parameterMap,
            json, bundle.getRpcServerUrl());
      } catch (OAuthException e) {
        throw new IllegalArgumentException("Error validating OAuth request", e);
      }
    }
    return bundle;
View Full Code Here

    BlipSubmittedEvent event1 = new BlipSubmittedEvent(null, null, "foo@test.com", 1l, "blip1");
    DocumentChangedEvent event2 = new DocumentChangedEvent(null, null, "foo@test.com", 1l, "blip1");
    WaveletTagsChangedEvent event3 = new WaveletTagsChangedEvent(null, null, "foo@test.com", 1l,
        "blip1");

    EventMessageBundle bundle = new EventMessageBundle("Foo", "http://gmodules.com/api/rpc");
    bundle.addEvent(event1);
    bundle.addEvent(event2);
    bundle.addEvent(event3);
    bundle.setWaveletData(waveletData);
    String json = new GsonFactory().create().toJson(bundle);

    MockWriter mockWriter = new MockWriter();
    robot.doPost(
        makeMockRequest(JSONRPC_PATH, new BufferedReader(new StringReader(json))),
View Full Code Here

    Blip blip = mock(Blip.class);
    when(blip.getBlipId()).thenReturn("blip123");
    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getBlip("blip123")).thenReturn(blip);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");

    WaveletParticipantsChangedEvent expected = new WaveletParticipantsChangedEvent(wavelet,
        bundle, "mprasetya@google.com", 1l, "blip123", participantsAdded, participantsRemoved);
View Full Code Here

    Blip blip = mock(Blip.class);
    when(blip.getBlipId()).thenReturn("blip123");
    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getBlip("blip123")).thenReturn(blip);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");

    BlipContributorsChangedEvent expected = new BlipContributorsChangedEvent(wavelet,
        bundle, "mprasetya@google.com", 1l, "blip123", contributorsAdded, contributorsRemoved);
View Full Code Here

    Blip blip = mock(Blip.class);
    when(blip.getBlipId()).thenReturn("blip123");
    Wavelet wavelet = mock(Wavelet.class);
    when(wavelet.getBlip("blip123")).thenReturn(blip);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");

    GadgetStateChangedEvent expected = new GadgetStateChangedEvent(wavelet, bundle,
        "mprasetya@google.com", 1l, "blip123", 5, oldState);
View Full Code Here

    assertEquals(expected.getOldState(),actual.getOldState());
  }

  public void testSerializeAndDeserializeOperationErrorEvent() throws Exception {
    Wavelet wavelet = mock(Wavelet.class);
    EventMessageBundle bundle = new EventMessageBundle("http://10.1.1.1",
        "http://wave-active-api.example.com");

    OperationErrorEvent expected = new OperationErrorEvent(wavelet, bundle,
        "foo@google.com", 123l, "op1", "Error!");
    Context context = new Context();
View Full Code Here

   * @param req the HTTP request.
   * @param resp the HTTP response.
   */
  private void processRpc(HttpServletRequest req, HttpServletResponse resp) {
    // Deserialize and process the incoming events.
    EventMessageBundle events = null;
    try {
      events = deserializeEvents(req);
    } catch (IOException e) {
      resp.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR);
      return;
    }

    // Append robot.notifyCapabilitiesHash operation before processing the
    // events.
    OperationQueue operationQueue = events.getWavelet().getOperationQueue();
    operationQueue.notifyRobotInformation(WaveService.PROTOCOL_VERSION, version);

    // Call the robot event handlers.
    processEvents(events);

View Full Code Here

   */
  private EventMessageBundle deserializeEvents(HttpServletRequest req) throws IOException {
    String json = readRequestBody(req);
    LOG.info("Incoming events: " + json);

    EventMessageBundle bundle = SERIALIZER.fromJson(json, EventMessageBundle.class);

    if (bundle.getRpcServerUrl() == null) {
      throw new IllegalArgumentException("RPC server URL is not set in the event bundle.");
    }

    if (!isUnsignedRequestsAllowed()) {
      if (!waveService.hasConsumerData(bundle.getRpcServerUrl())) {
        throw new IllegalArgumentException("No consumer key is found for the RPC server URL: " +
            bundle.getRpcServerUrl());
      }

      // Validates the request.
      try {
        @SuppressWarnings("unchecked")
        Map<String, String[]> parameterMap = req.getParameterMap();
        waveService.validateOAuthRequest(req.getRequestURL().toString(), parameterMap,
            json, bundle.getRpcServerUrl());
      } catch (OAuthException e) {
        throw new IllegalArgumentException("Error validating OAuth request", e);
      }
    }
    return bundle;
View Full Code Here

TOP

Related Classes of com.google.wave.api.impl.EventMessageBundle

Copyright © 2018 www.massapicom. 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.