Search in sources :

Example 1 with IFoo

use of org.ovirt.engine.api.restapi.test.mappers.api.IFoo in project ovirt-engine by oVirt.

the class MappingLocatorTest method testStaticBarToFooInterfaceMapper.

@Test
public void testStaticBarToFooInterfaceMapper() {
    Mapper<IBar, IFoo> mapper = mappingLocator.getMapper(IBar.class, IFoo.class);
    assertNotNull(mapper);
    IFoo foo = mapper.map(new BarImpl("bar"), null);
    assertEquals("bar", foo.get());
}
Also used : IBar(org.ovirt.engine.api.restapi.test.mappers.api.IBar) BarImpl(org.ovirt.engine.api.restapi.test.mappers.impl.BarImpl) IFoo(org.ovirt.engine.api.restapi.test.mappers.api.IFoo) Test(org.junit.Test)

Example 2 with IFoo

use of org.ovirt.engine.api.restapi.test.mappers.api.IFoo in project ovirt-engine by oVirt.

the class MappingLocatorTest method testStaticBarToFooClassMapper.

@Test
public void testStaticBarToFooClassMapper() {
    Mapper<BarImpl, FooImpl> mapper = mappingLocator.getMapper(BarImpl.class, FooImpl.class);
    assertNotNull(mapper);
    IFoo foo = mapper.map(new BarImpl("bar"), null);
    assertEquals("bar", foo.get());
}
Also used : BarImpl(org.ovirt.engine.api.restapi.test.mappers.impl.BarImpl) FooImpl(org.ovirt.engine.api.restapi.test.mappers.impl.FooImpl) IFoo(org.ovirt.engine.api.restapi.test.mappers.api.IFoo) Test(org.junit.Test)

Example 3 with IFoo

use of org.ovirt.engine.api.restapi.test.mappers.api.IFoo in project ovirt-engine by oVirt.

the class StaticMapper method mapBarToFooInterfaces.

@Mapping(from = IBar.class, to = IFoo.class)
public static IFoo mapBarToFooInterfaces(IBar bar, IFoo template) {
    IFoo foo = template != null ? template : new FooImpl();
    foo.set(bar.get());
    return foo;
}
Also used : FooImpl(org.ovirt.engine.api.restapi.test.mappers.impl.FooImpl) IFoo(org.ovirt.engine.api.restapi.test.mappers.api.IFoo) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Example 4 with IFoo

use of org.ovirt.engine.api.restapi.test.mappers.api.IFoo in project ovirt-engine by oVirt.

the class MappingLocatorTest method testStaticFooToBarInterfaceMapper.

@Test
public void testStaticFooToBarInterfaceMapper() {
    Mapper<IFoo, IBar> mapper = mappingLocator.getMapper(IFoo.class, IBar.class);
    assertNotNull(mapper);
    IBar bar = mapper.map(new FooImpl("foo"), null);
    assertEquals("foo", bar.get());
}
Also used : IBar(org.ovirt.engine.api.restapi.test.mappers.api.IBar) FooImpl(org.ovirt.engine.api.restapi.test.mappers.impl.FooImpl) IFoo(org.ovirt.engine.api.restapi.test.mappers.api.IFoo) Test(org.junit.Test)

Aggregations

IFoo (org.ovirt.engine.api.restapi.test.mappers.api.IFoo)4 Test (org.junit.Test)3 FooImpl (org.ovirt.engine.api.restapi.test.mappers.impl.FooImpl)3 IBar (org.ovirt.engine.api.restapi.test.mappers.api.IBar)2 BarImpl (org.ovirt.engine.api.restapi.test.mappers.impl.BarImpl)2 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1