use of org.apache.ibatis.domain.blog.Author in project mybatis-3 by mybatis.
the class JavassistProxyTest method shouldFailCallingAnUnloadedProperty.
@Test(expected = ExecutorException.class)
public void shouldFailCallingAnUnloadedProperty() throws Exception {
// yes, it must go in uppercase
HashMap<String, ResultLoaderMap.LoadPair> unloadedProperties = new HashMap<String, ResultLoaderMap.LoadPair>();
unloadedProperties.put("ID", null);
Author author2 = (Author) ((JavassistProxyFactory) proxyFactory).createDeserializationProxy(author, unloadedProperties, new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
author2.getId();
}
use of org.apache.ibatis.domain.blog.Author in project mybatis-3 by mybatis.
the class JavassistProxyTest method shouldSerizalizeADeserlizaliedProxy.
@Test
public void shouldSerizalizeADeserlizaliedProxy() throws Exception {
Object proxy = ((JavassistProxyFactory) proxyFactory).createDeserializationProxy(author, new HashMap<String, ResultLoaderMap.LoadPair>(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author, author2);
assertFalse(author.getClass().equals(author2.getClass()));
}
use of org.apache.ibatis.domain.blog.Author in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldNotLetReadUnloadedPropertyAfterTwoSerializations.
@Test(expected = ExecutorException.class)
public void shouldNotLetReadUnloadedPropertyAfterTwoSerializations() throws Exception {
ResultLoaderMap loader = new ResultLoaderMap();
loader.addLoader("id", null, null);
Object proxy = proxyFactory.createProxy(author, loader, new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
Author author2 = (Author) deserialize(serialize(deserialize(serialize((Serializable) proxy))));
author2.getId();
}
use of org.apache.ibatis.domain.blog.Author in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldKeepGenericTypes.
@Test
public void shouldKeepGenericTypes() throws Exception {
for (int i = 0; i < 10000; i++) {
Author pc = new Author();
Author proxy = (Author) proxyFactory.createProxy(pc, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
proxy.getBio();
}
}
use of org.apache.ibatis.domain.blog.Author in project mybatis-3 by mybatis.
the class SerializableProxyTest method shouldNotCreateAProxyForAFullyLoadedBean.
@Test
public void shouldNotCreateAProxyForAFullyLoadedBean() throws Exception {
Object proxy = proxyFactory.createProxy(author, new ResultLoaderMap(), new Configuration(), new DefaultObjectFactory(), new ArrayList<Class<?>>(), new ArrayList<Object>());
Author author2 = (Author) deserialize(serialize((Serializable) proxy));
assertEquals(author.getClass(), author2.getClass());
}
Aggregations