Package org.springframework.osgi.mock

Examples of org.springframework.osgi.mock.MockBundle


  public void testBundleHeaderWithoutText() throws Exception {
    String value = "   ";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);

    assertEquals("/", strategy.getContextPath(bundle));
  }
View Full Code Here


    final String expectedContextPath = "someLocation";

    final Dictionary dict = new Properties();
    dict.put("Web-ContextPth", "somethingElse");

    Bundle bundle = new MockBundle() {

      public Dictionary getHeaders() {
        return dict;
      }
View Full Code Here

  public void testBundleHeaderEncoding() throws Exception {
    String value = "some file";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);

    String path = strategy.getContextPath(bundle);
    assertTrue(path.startsWith("/"));
    assertEquals("/" + encode(value), path);
  }
View Full Code Here

  public void testEmptyWebContextPath() throws Exception {
    String value = "";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals("/", path);
  }
View Full Code Here

  public void testRootWebContextPath() throws Exception {
    String value = "/";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals(value, path);
  }
View Full Code Here

  public void testWebContextPathStartsWithSlash() throws Exception {
    String value = "/web";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals(value, path);
  }
View Full Code Here

  public void testWebContextPathContainsExtraWhiteSpaces() throws Exception {
    String value = " /web  ";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals(value.trim(), path);
  }
View Full Code Here

  public void testWebContextWithNestedPath() throws Exception {
    String value = "/web/my/app";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals(value, path);
  }
View Full Code Here

  public void testWebContextWithNestedPathAndMultipleSlashes() throws Exception {
    String value = "/web/my/super/uber-nice/app/";
    Dictionary headers = new Properties();
    headers.put("Web-ContextPath", value);
    Bundle bundle = new MockBundle(headers);
    String path = strategy.getContextPath(bundle);
    assertEquals(value, path);
  }
View Full Code Here

  protected void setUp() throws Exception {
    service = new Polygon();
    RefContainer.reference = null;

    MockBundle bundle = new MockBundle() {
      public Enumeration findEntries(String path, String filePattern, boolean recurse) {
        try {
          return new ArrayEnumerator(
              new URL[] { new ClassPathResource(
                  "/org/springframework/osgi/internal/context/support/serviceReferenceConversion.xml").getURL() });
View Full Code Here

TOP

Related Classes of org.springframework.osgi.mock.MockBundle

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.