Package org.apache.shindig.gadgets.spec

Examples of org.apache.shindig.gadgets.spec.MessageBundle


    assertEquals(MSG_3_VALUE, bundle.getMessages().get(MSG_3_NAME));
  }

  @Test
  public void getViewCountryBundle() throws Exception {
    MessageBundle bundle = bundleFactory.getBundle(gadgetSpec, COUNTRY_LOCALE, true, ContainerConfig.DEFAULT_CONTAINER, "view1");

    assertEquals(MSG_0_VIEW_VALUE, bundle.getMessages().get(MSG_0_NAME));
    assertNull(bundle.getMessages().get(MSG_1_NAME));
    assertEquals(MSG_2_VIEW_VALUE, bundle.getMessages().get(MSG_2_NAME));
    assertEquals(MSG_3_VALUE, bundle.getMessages().get(MSG_3_NAME));
  }
View Full Code Here


  }


  @Test
  public void getViewAllAllBundle() throws Exception {
    MessageBundle bundle = bundleFactory.getBundle(gadgetSpec, new Locale("all", "ALL"), true, ContainerConfig.DEFAULT_CONTAINER, "view1");

    assertEquals(MSG_0_ALL_VALUE, bundle.getMessages().get(MSG_0_NAME));
    assertNull(bundle.getMessages().get(MSG_1_NAME));
    assertEquals(MSG_2_VIEW_VALUE, bundle.getMessages().get(MSG_2_NAME));
    assertNull(bundle.getMessages().get(MSG_3_NAME));
  }
View Full Code Here

    assertNull(bundle.getMessages().get(MSG_3_NAME));
  }

  @Test
  public void getAllAllBundle() throws Exception {
    MessageBundle bundle = bundleFactory.getBundle(gadgetSpec, new Locale("all", "ALL"), true, ContainerConfig.DEFAULT_CONTAINER, null);
    assertEquals(MSG_0_ALL_VALUE, bundle.getMessages().get(MSG_0_NAME));
    assertNull(bundle.getMessages().get(MSG_1_NAME));
    assertNull(bundle.getMessages().get(MSG_2_NAME));
    assertNull(bundle.getMessages().get(MSG_3_NAME));
  }
View Full Code Here

    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(countryResponse);
    HttpResponse allAllResponse = new HttpResponse(ALL_ALL_BUNDLE);
    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(allAllResponse);

    replay(pipeline);
    MessageBundle bundle = bundleFactory.getBundle(externalSpec, LOCALE, true, ContainerConfig.DEFAULT_CONTAINER, null);
    verify(pipeline);

    assertEquals("true", bundle.getMessages().get("lang"));
    assertEquals("true", bundle.getMessages().get("country"));
    assertEquals("true", bundle.getMessages().get("all"));
    assertEquals(MSG_0_VALUE, bundle.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(langResponse);
    HttpResponse allAllResponse = new HttpResponse(ALL_ALL_BUNDLE);
    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(allAllResponse);

    replay(pipeline);
    MessageBundle bundle = bundleFactory.getBundle(externalSpec, LANG_LOCALE, true, ContainerConfig.DEFAULT_CONTAINER, null);
    verify(pipeline);

    assertEquals("true", bundle.getMessages().get("lang"));
    assertEquals("true", bundle.getMessages().get("all"));
    assertEquals(MSG_0_LANG_VALUE, bundle.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(countryResponse);
    HttpResponse allAllResponse = new HttpResponse(ALL_ALL_BUNDLE);
    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(allAllResponse);

    replay(pipeline);
    MessageBundle bundle = bundleFactory.getBundle(externalSpec, COUNTRY_LOCALE, true, ContainerConfig.DEFAULT_CONTAINER, null);
    verify(pipeline);

    assertEquals("true", bundle.getMessages().get("country"));
    assertEquals("true", bundle.getMessages().get("all"));
    assertEquals(MSG_0_COUNTRY_VALUE, bundle.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

  public void getAllAllExternal() throws Exception {
    HttpResponse allAllResponse = new HttpResponse(ALL_ALL_BUNDLE);
    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(allAllResponse);

    replay(pipeline);
    MessageBundle bundle = bundleFactory.getBundle(externalSpec, new Locale("all", "ALL"), true, ContainerConfig.DEFAULT_CONTAINER, null);
    verify(pipeline);

    assertEquals("true", bundle.getMessages().get("all"));
    assertEquals(MSG_0_ALL_VALUE, bundle.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

  public void getBundleFromCache() throws Exception {
    HttpResponse response = new HttpResponse(BASIC_BUNDLE);
    expect(pipeline.execute(isA(HttpRequest.class))).andReturn(response).once();
    replay(pipeline);

    MessageBundle bundle0 = bundleFactory.getBundle(gadgetSpec, LOCALE, false, ContainerConfig.DEFAULT_CONTAINER, null);
    MessageBundle bundle1 = bundleFactory.getBundle(gadgetSpec, LOCALE, false, ContainerConfig.DEFAULT_CONTAINER, null);

    verify(pipeline);

    assertEquals(bundle0.getMessages().get(MSG_0_NAME), bundle1.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

      }
    });

    time.set(System.currentTimeMillis());

    MessageBundle bundle0 = bundleFactory.getBundle(gadgetSpec, LOCALE, false, ContainerConfig.DEFAULT_CONTAINER, null);

    time.set(time.get() + MAX_AGE + 1);

    MessageBundle bundle1 = bundleFactory.getBundle(gadgetSpec, LOCALE, false, ContainerConfig.DEFAULT_CONTAINER, null);

    verify(pipeline);

    assertEquals(bundle0.getMessages().get(MSG_0_NAME), bundle1.getMessages().get(MSG_0_NAME));
  }
View Full Code Here

  private Expressions expressions;
  private ELContext context;

  @Before
  public void setUp() throws Exception {
    messageBundle = new MessageBundle(XmlUtil.parse(MESSAGE_BUNDLE));
    expressions = Expressions.forTesting();
    context = expressions.newELContext(new MessageELResolver(expressions, messageBundle));
  }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.spec.MessageBundle

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.