Examples of ILocaleContainer


Examples of it.hotel.controller.locale.ILocaleContainer

public class TestMultiLingualInterceptor extends TestCase {

  public void testAfterReturningSingleObject() throws Throwable {
   
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
   
    MultiLingualInterceptor interceptor = new MultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
   
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
   
    Method m = cls.getMethod("get", new Class[] {int.class});
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

    verify(localeContainer);
   
  }
 
  public void testAfterReturningACollection() throws Exception {
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
   
    MultiLingualInterceptor interceptor = new MultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
   
    Hotel h1 = new Hotel();
    h1.setBriefdescription("Hotel.Briefdescription");
    h1.setDescription("Hotel.Description");
    h1.setId(2);
   
    ArrayList<Hotel> hotellist = new ArrayList<Hotel>();
    hotellist.add(h);
    hotellist.add(h1);
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
    label.setLanguage("it");
    label.setText("this is something");
   
    Label label2 = new Label();
    label2.setCode("Hotel.Briefdescription");
    label2.setId(2);
    label2.setLanguage("it");
    label2.setText("this is something else");
   
   
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
   
    Method m = cls.getMethod("getAll");
   
    expect(labelManager.getLabel(1, "Hotel.Briefdescription", "it")).andReturn(label);
    expect(labelManager.getLabel(1, "Hotel.Description", "it")).andReturn(label);
    expect(labelManager.getLabel(2, "Hotel.Briefdescription", "it")).andReturn(label2);
    expect(labelManager.getLabel(2, "Hotel.Description", "it")).andReturn(label2);
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
   
    replay(localeContainer);
    replay(labelManager);
   
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

   
   
  }
 
  public void testRecursivelyTestLabelsForObject() throws Exception {
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
   
    MultiLingualInterceptor interceptor = new MultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
   
    Room room = new Room();
    room.setId(1);
    room.setStructure(h);
   
    Typology typology = new Typology();
    typology.setId(1);
    typology.setName("something");
   
    room.setTypology(typology);
   
    RoomManager rmanager = new RoomManager();
    Class cls = RoomManager.class;
   
    Method m = cls.getMethod("get", new Class[] {int.class});
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
   
    Label label = new Label();
    label.setCode("Typology.Name");
    label.setId(1);
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

    verify(localeContainer);
   
  }
 
  public void testRecursivelyTestLabelsForEmptyObject() throws Exception {
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
   
    MultiLingualInterceptor interceptor = new MultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
   
    Room room = new Room();
    room.setId(1);
    room.setStructure(h);
   
    //Typology has no values set to simulate hibernate not populating the object
    Typology typology = new Typology();
    typology.setId(1);
   
    room.setTypology(typology);
   
    RoomManager rmanager = new RoomManager();
    Class cls = RoomManager.class;
   
    Method m = cls.getMethod("get", new Class[] {int.class});
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
   
   
    replay(localeContainer);
    replay(labelManager);
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

  public void testInvoke() throws Exception {
   
    AddMultiLingualInterceptor interceptor = new AddMultiLingualInterceptor();
    MethodInvocation invoke = createMock(MethodInvocation.class);
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
    expect(labelManager.add(isA(Label.class))).andReturn(true);
    expectLastCall().anyTimes();
   
    replay(localeContainer);
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

 
  public int doStartTag() {
    WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());
    UserContainer container = (UserContainer) context.getBean("userContainer");
    IStructureManager structureManager = (IStructureManager) context.getBean("localizedStructureManager");
    ILocaleContainer localeContainer = (ILocaleContainer) context.getBean("localeContainer");
   
    try {
        IUser user = container.getUser();
        Collection<Structure> structures = structureManager.fastGetAll();
        if (structures.isEmpty()){
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

public class TestRemoveMultiLingualInterceptor extends TestCase {

  public void testAfterReturningWithObject() throws Throwable {
   
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
    MethodInvocation invoke = createMock(MethodInvocation.class);
   
    RemoveMultiLingualInterceptor interceptor = new RemoveMultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
    Method m = cls.getMethod("remove", new Class[] {Object.class});
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
    label.setLanguage("it");
    label.setText("this is something");
   
   
    HashMap<String,Label> labelList = new HashMap<String,Label>();
    labelList.put("Hotel.Briefdescription", label);
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
    expect(labelManager.getLabels(1,"Hotel.Briefdescription")).andReturn(labelList);
    expect(labelManager.getLabels(1,"Hotel.Description")).andReturn(labelList);
    labelManager.remove(isA(Label.class));
    labelManager.remove(isA(Label.class));
View Full Code Here

Examples of it.hotel.controller.locale.ILocaleContainer

   
  }
 
public void testAfterReturningWithId() throws Throwable {
   
    ILocaleContainer localeContainer = createMock(ILocaleContainer.class);
    ILabelManager labelManager = createMock(ILabelManager.class);
    MethodInvocation invoke = createMock(MethodInvocation.class);
   
    HotelManager hotelManagerMock =
        org.easymock.classextension.EasyMock.createMock(HotelManager.class,  new Method[] {
             HotelManager.class.getMethod("get",int.class),
        } );
   
    RemoveMultiLingualInterceptor interceptor = new RemoveMultiLingualInterceptor();
    interceptor.setLabelManager(labelManager);
    interceptor.setLocaleContainer(localeContainer);
   
    Hotel h = new Hotel();
    h.setBriefdescription("Hotel.Briefdescription");
    h.setDescription("Hotel.Description");
    h.setId(1);
    HotelManager hmanager = new HotelManager();
    Class cls = HotelManager.class;
    Method m = cls.getMethod("remove", new Class[] {int.class});
   
    Label label = new Label();
    label.setCode("Hotel.Briefdescription");
    label.setId(1);
    label.setLanguage("it");
    label.setText("this is something");
   
   
    HashMap<String,Label> labelList = new HashMap<String,Label>();
    labelList.put("Hotel.Briefdescription", label);
   
    expect(hotelManagerMock.get(1)).andReturn(h);
   
    expect(localeContainer.getLocale()).andReturn("it");
    expectLastCall().anyTimes();
    expect(labelManager.getLabels(1,"Hotel.Briefdescription")).andReturn(labelList);
    expect(labelManager.getLabels(1,"Hotel.Description")).andReturn(labelList);
    labelManager.remove(isA(Label.class));
    labelManager.remove(isA(Label.class));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.