コード例 #1
0
  private String checkPBIAndGetNavigationalState(String symbol) throws Exception {
    V1PerformBlockingInteraction performBlockingInteraction =
        createDefaultPerformBlockingInteraction(getDefaultHandle());
    V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();
    interactionParams.getFormParameters().add(createNamedString("symbol", symbol));

    V1BlockingInteractionResponse response =
        producer.performBlockingInteraction(performBlockingInteraction);
    ExtendedAssert.assertNotNull(response);

    // this is not a redirect...
    ExtendedAssert.assertNull(response.getRedirectURL());

    // check update response
    V1UpdateResponse updateResponse = response.getUpdateResponse();
    ExtendedAssert.assertNotNull(updateResponse);
    // request was readOnly so no updated portlet context
    ExtendedAssert.assertNull(updateResponse.getPortletContext());
    // check that no sessionId is getting passed.
    ExtendedAssert.assertNull(updateResponse.getSessionContext());

    String navigationalState = updateResponse.getNavigationalState();
    ExtendedAssert.assertNotNull(navigationalState);
    ExtendedAssert.assertEquals(updateResponse.getNewMode(), WSRPConstants.VIEW_MODE);
    V1MarkupContext markupContext = updateResponse.getMarkupContext();
    ExtendedAssert.assertNull(markupContext); // we don't return markup for now

    return navigationalState;
  }
コード例 #2
0
  @Test
  public void testPerformBlockingInteractionRedirect() throws Exception {
    V1PerformBlockingInteraction performBlockingInteraction =
        createDefaultPerformBlockingInteraction(getDefaultHandle());
    V1InteractionParams interactionParams = performBlockingInteraction.getInteractionParams();

    // crappy way but this is a test! ;)
    V1NamedString namedString = new V1NamedString();
    namedString.setName("symbol");
    namedString.setValue("HELP");
    interactionParams.getFormParameters().add(namedString);

    V1BlockingInteractionResponse response =
        producer.performBlockingInteraction(performBlockingInteraction);
    ExtendedAssert.assertNotNull(response);

    // this is a redirect...
    String redirectURL = response.getRedirectURL();
    ExtendedAssert.assertNotNull(redirectURL);
    ExtendedAssert.assertEquals(
        "/WEB-INF/jsp/help.jsp", redirectURL); // fix-me: handle URL re-writing

    // no update response
    V1UpdateResponse updateResponse = response.getUpdateResponse();
    ExtendedAssert.assertNull(updateResponse);
  }