Package com.mockey.model

Examples of com.mockey.model.Url


        // Build a list of real Url objects.
        for (Url realUrl : service.getRealServiceUrls()) {
          for (String replacement : replacementArray) {
            // We don't want to inject empty string match
            if (replacement.trim().length() > 0) {
              Url newUrl = new Url(realUrl.getFullUrl()
                  .replaceAll(matchPattern, replacement));
              if (!service.hasRealServiceUrl(newUrl)) {
                newUrlList.add(newUrl);
                // Note: you should not save or update
                // the realServiceUrl or service while
View Full Code Here


      List<Url> newUrlList = new ArrayList<Url>();
      for (int i = 0; i < realSrvUrl.length; i++) {
        String url = realSrvUrl[i];
        if (url.trim().length() > 0) {

          newUrlList.add(new Url(realSrvUrl[i].trim()));
        }

      }
      // Before we ADD new URLS, let's start with a clean list.
      // Why? In case the user removes the URL within the form,
View Full Code Here

    // New Store
    // ***************************
    Service service = new Service();
    service.setServiceName("Service 1");
    service.setTag("abc");
    service.saveOrUpdateRealServiceUrl(new Url("http://www.abc.com"));

    store.saveOrUpdateService(service);

    // ***************************
    // Get the store as XML
    // ***************************
    String storeAsXml = getStoreAsXml();

    // ***************************
    // Rebuild the store with:
    // - Same Service
    // - Different URL
    // ***************************
    store.deleteEverything();
    service = new Service();
    service.setServiceName("Service 1");
    service.setTag("def");

    service.saveOrUpdateRealServiceUrl(new Url("http://www.def.com"));

    store.saveOrUpdateService(service);

    // ***************************
    // Upload/Merge the store again.
View Full Code Here

  private List<Service> getServiceList() {
    List<Service> serviceList = new ArrayList<Service>();

    Service service = new Service();
    service.setServiceName("Service 1");
    service.saveOrUpdateRealServiceUrl(new Url("http://www.abc.com"));
    service.saveOrUpdateRealServiceUrl(new Url("http://www.nbc.com"));
    serviceList.add(service);

    Service serviceB = new Service();
    serviceB.setServiceName("Service 22");
    serviceB.saveOrUpdateRealServiceUrl(new Url("http://www.abc.com"));
    serviceB.saveOrUpdateRealServiceUrl(new Url("http://www.nbc.com"));
    serviceList.add(serviceB);
    return serviceList;
  }
View Full Code Here

public class MockServiceBeanTest {

    @Test
    public void parsesRealServiceUrlIntoHostAndPath() {
       
        Url url = new Url("mfasa-qa2.chase.com/auth/fcc/login");
        assert "mfasa-qa2.chase.com".equals(url.getHost()) : "Real Service Host should be: mfasa-qa2.chase.com";
        assert "/auth/fcc/login".equals(url.getPath()) : "Real service path should be: /auth/fcc/login";
    }
View Full Code Here

        assert "/auth/fcc/login".equals(url.getPath()) : "Real service path should be: /auth/fcc/login";
    }

    @Test
    public void parsesSchemeFromRealServiceUrl() {
        Url url = new Url("HTtP://www.google.com");
        assert "www.google.com".equals(url.getHost()) : "expected www.google.com got "+url.getHost();
        assert "http".equalsIgnoreCase(url.getScheme());

        url.setUrl("https://gmail.com");
        assert "gmail.com".equals(url.getHost());
        assert "https".equals(url.getScheme());

        url.setUrl("wired.com");
        assert "wired.com".equals(url.getHost());
        assert "http".equals(url.getScheme());
    }
View Full Code Here

public class UrlTest {

  @Test
  public void parsesFullUrl() {
    String google = "http://www.google.com/test";
    Url url = new Url(google);

    assert "http".equals(url.getScheme());
    assert 80 == url.getPort();
    assert "www.google.com".equals(url.getHost());
    assert "/test".equals(url.getPath());
  }
View Full Code Here

  }

  @Test
  public void replacesEmptyPathWithSlash() {
    String google = "http://www.google.com";
    Url url = new Url(google);

    assert "/".equals(url.getPath()) : "expected path to be / but was " + url.getPath();
  }
View Full Code Here

  }

  @Test
  public void parsesPortFromUrl() {
    String tomcatUrl = "hTTp://localhost:8080";
    Url url = new Url(tomcatUrl);

    assert "http".equals(url.getScheme());
    assert 8080 == url.getPort();
  }
View Full Code Here

  }
 
  @Test
  public void validateEmptySetings() {
   
    Url emptySettings = new Url("");
    assert !emptySettings.hasSettings() : " Expected FALSE; with empty String as argument in constructor, should be 'no settings'.";
   
    emptySettings = new Url("   ");
    assert !emptySettings.hasSettings() : " Expected FALSE; with empty String as argument in constructor, should be 'no settings'.";
   
    emptySettings = new Url("http://www.google.com");
    assert emptySettings.hasSettings() : " Expected FALSE; with empty String as argument in constructor, should be 'no settings'.";
  }
View Full Code Here

TOP

Related Classes of com.mockey.model.Url

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.