Package it.hotel.model.label.manager

Examples of it.hotel.model.label.manager.ILabelManager


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);
    label.setLanguage("it");
    label.setText("this is something");
   
    expect(labelManager.getLabel(1, "Hotel.Briefdescription", "it")).andReturn(label);
    expect(labelManager.getLabel(1, "Hotel.Description", "it")).andReturn(label);
   
   
    replay(localeContainer);
    replay(labelManager);
   
View Full Code Here


   
  }
 
  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

   
  }
 
  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);
    label.setLanguage("it");
    label.setText("Doppia");
   
    expect(labelManager.getLabel(1, "Typology.Name", "it")).andReturn(label);
   
    replay(localeContainer);
    replay(labelManager);
   
    Integer i = new Integer(1);
View Full Code Here

   
  }
 
  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);
   
View Full Code Here

  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);
    replay(labelManager);
   
View Full Code Here

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));
   
    Object[] obj = {h};
   
    expect(invoke.getArguments()).andReturn(obj);
    expect(invoke.getThis()).andReturn(hmanager);
View Full Code Here

  }
 
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));
   
    Integer i = new Integer(1);
    Object[] obj = {i};
   
    expect(invoke.getArguments()).andReturn(obj);
View Full Code Here

TOP

Related Classes of it.hotel.model.label.manager.ILabelManager

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.