Package org.apache.wicket.request.mapper.parameter

Examples of org.apache.wicket.request.mapper.parameter.PageParameters$Entry


  @Test
  public void testAbort()
  {
    try
    {
      tester.startPage(AbortExceptionPage.class, new PageParameters().set("trigger", true));
      Assert.assertEquals(1234, tester.getLastResponse().getStatus()); // this will
      // fail
    }
    catch (RuntimeException x)
    {
View Full Code Here


      new QueryStringWithVersionResourceCachingStrategy(versionParameter, resourceVersion);

  @Test
  public void testDecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", new PageParameters());
    strategy.decorateUrl(resourceUrl, new TestResource());

    assertEquals("some-resource.txt", resourceUrl.getFileName());
    assertEquals(TEST_RESOURCE_VERSION, resourceUrl.getParameters().get(versionParameter).toString());
  }
View Full Code Here

  }

  @Test
  public void testUndecorateUrl() throws Exception
  {
    PageParameters urlParameters = new PageParameters();
    urlParameters.add(versionParameter, TEST_RESOURCE_VERSION, INamedParameters.Type.QUERY_STRING);
    ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", urlParameters);
    strategy.undecorateUrl(resourceUrl);

    assertEquals("some-resource.txt", resourceUrl.getFileName());
    assertNull(resourceUrl.getParameters().get(versionParameter).toString());
View Full Code Here

    WicketTester tester = new WicketTester();
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);

    try
    {
      PageParameters urlParameters = new PageParameters();
      urlParameters.add(versionParameter, "9A0364B9E99BB480DD25E1F0284C8555", INamedParameters.Type.QUERY_STRING);
      ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", urlParameters);
      strategy.undecorateUrl(resourceUrl);

      String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);
View Full Code Here

      new FilenameWithVersionResourceCachingStrategy(versionPrefix, resourceVersion);

  @Test
  public void testDecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", new PageParameters());
    strategy.decorateUrl(resourceUrl, new TestResource());

    assertEquals("some-resource--vers--"+TEST_RESOURCE_VERSION+".txt", resourceUrl.getFileName());

    // don't issue an error
    resourceUrl = new ResourceUrl("some-resource--vers--with-prefix.txt", new PageParameters());
    strategy.decorateUrl(resourceUrl, new TestResource());

    assertEquals("some-resource--vers--with-prefix--vers--"+TEST_RESOURCE_VERSION+".txt", resourceUrl.getFileName());
  }
View Full Code Here

  }

  @Test
  public void testUndecorateUrl() throws Exception
  {
    ResourceUrl resourceUrl = new ResourceUrl("some-resource--vers--"+TEST_RESOURCE_VERSION+".txt", new PageParameters());
    strategy.undecorateUrl(resourceUrl);

    assertEquals("some-resource.txt", resourceUrl.getFileName());

    // test URL with versiton containing prefix in original
    resourceUrl = new ResourceUrl("some-resource--vers--with-prefix--vers--"+TEST_RESOURCE_VERSION+".txt", new PageParameters());
    strategy.undecorateUrl(resourceUrl);

    assertEquals("some-resource--vers--with-prefix.txt", resourceUrl.getFileName());

    // test URL without version containing prefix
    resourceUrl = new ResourceUrl("some-resource--vers--without-version.txt", new PageParameters());
    strategy.undecorateUrl(resourceUrl);

    assertEquals("some-resource--vers--without-version.txt", resourceUrl.getFileName());
  }
View Full Code Here

    WicketTester tester = new WicketTester();
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);

    try
    {
      ResourceUrl resourceUrl = new ResourceUrl("some-resource--vers--"+TEST_RESOURCE_VERSION+".txt", new PageParameters());
      strategy.undecorateUrl(resourceUrl);

      String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);

      assertEquals(TEST_RESOURCE_VERSION, version);
View Full Code Here

   *            identifier
   * @return page parameter suitable for URLs to this resource
   */
  public static PageParameters newParameter(String upload)
  {
    return new PageParameters().add(UPLOAD_PARAMETER, upload);
  }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                outputData.getEntry().add(outputEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(outputEntry);
                                outputData.getEntry().add(durationEntry);
                                if(testRecord.get(TEST_STATUS) != null){
                                    Entry statusEntry = new Entry();
                                    statusEntry.setKey(TEST_STATUS);
                                    statusEntry.setValue(testRecord.get(TEST_STATUS).toString());
                                    outputData.getEntry().add(statusEntry);
                                }
                               
                               
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
                        }
                        if (outputDataAdded) {
                            break;
                        }
                    }
                }else{
                    //Method did not return any data. So only write the duration as output
                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(durationEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.mapper.parameter.PageParameters$Entry

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.