@BeforeClass
  public static void setUpClass() throws Exception {
    RegistryUtil.setRegistry(new BasicRegistryImpl());

    MultiVMPoolUtil multiVMPoolUtil = new MultiVMPoolUtil();

    MultiVMPoolImpl multiVMPoolImpl = new MultiVMPoolImpl();

    multiVMPoolImpl.setPortalCacheManager(
        MemoryPortalCacheManager.<Serializable, Serializable>createMemoryPortalCacheManager(
            "multi.vm.pool"));

    multiVMPoolUtil.setMultiVMPool(multiVMPoolImpl);

    SingleVMPoolUtil singleVMPoolUtil = new SingleVMPoolUtil();

    SingleVMPoolImpl singleVMPoolImpl = new SingleVMPoolImpl();

    singleVMPoolImpl.setPortalCacheManager(
        MemoryPortalCacheManager.createMemoryPortalCacheManager("single.vm.pool"));

    singleVMPoolUtil.setSingleVMPool(singleVMPoolImpl);

    _templateResourceLoader = new MockTemplateResourceLoader();

    _templateResourceLoader.activate(Collections.<String, Object>emptyMap());

    Registry registry = RegistryUtil.getRegistry();

    _serviceRegistration =
        registry.registerService(TemplateResourceLoader.class, _templateResourceLoader);
  }
  @Before
  public void setUp() {
    SingleVMPoolUtil singleVMPoolUtil = new SingleVMPoolUtil();

    SingleVMPoolImpl singleVMPoolImpl = new SingleVMPoolImpl();

    singleVMPoolImpl.setPortalCacheManager(
        MemoryPortalCacheManager.createMemoryPortalCacheManager(
            PortletPreferencesFactoryImplUnitTest.class.getName()));

    singleVMPoolUtil.setSingleVMPool(singleVMPoolImpl);

    PortletPreferencesFactoryUtil portletPreferencesFactoryUtil =
        new PortletPreferencesFactoryUtil();

    portletPreferencesFactoryUtil.setPortletPreferencesFactory(new PortletPreferencesFactoryImpl());

    _layout.setCompanyId(RandomTestUtil.randomLong());
    _layout.setPlid(RandomTestUtil.randomLong());
    _layout.setPrivateLayout(true);
  }