final IPortletEntity localPortletEntity = portletEntityRegistry.getPortletEntity(request, portletEntity.getPortletEntityId().getStringId());
assertEquals(portletEntity, localPortletEntity);
//T2 - Add a preference
final List<IPortletPreference> preferences = localPortletEntity.getPortletPreferences();
final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
preferences.add(portletPreference);
//T2 - Store the entity
portletEntityRegistry.storePortletEntity(request, localPortletEntity);
return localPortletEntity.getPortletEntityId();
}
});
//T2 - verify entity was made persistent
executeInThread("T2.2", new Callable<Object>() {
@Override
public Object call() throws Exception {
//T2 - Verify it was converted from interim to persistent
IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
assertEquals(1, preferences.size());
return null;
}
});
//T1 - Add a preference
final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
final IPortletPreference portletPreference = new PortletPreferenceImpl("pref1", false, "value");
preferences.add(portletPreference);
//T1 - Store the entity
portletEntityRegistry.storePortletEntity(request, portletEntity);