Skip to content

Commit

Permalink
LPS-84315 Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tinatian authored and brianchandotcom committed Aug 22, 2018
1 parent 93862aa commit e093a17
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -16,6 +16,7 @@

import com.liferay.portal.configuration.metatype.bnd.util.ConfigurableUtil;
import com.liferay.portal.kernel.cache.MultiVMPool;
import com.liferay.portal.kernel.cache.PortalCacheManagerNames;
import com.liferay.portal.kernel.cache.SingleVMPool;
import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter;
import com.liferay.portal.kernel.template.StringTemplateResource;
Expand All @@ -34,6 +35,7 @@
import com.liferay.portal.util.FileImpl;
import com.liferay.registry.Registry;
import com.liferay.registry.RegistryUtil;
import com.liferay.registry.ServiceReference;
import com.liferay.registry.ServiceRegistration;

import java.io.IOException;
Expand Down Expand Up @@ -93,6 +95,10 @@ public static void setUpClass() throws Exception {
TemplateResourceParser.class, new ClassLoaderResourceParser(),
Collections.<String, Object>singletonMap(
"lang.type", TemplateConstants.LANG_TYPE_VM)));

_serviceReference = registry.getServiceReference(SingleVMPool.class);

_singleVMPool = registry.getService(_serviceReference);
}

@AfterClass
Expand All @@ -104,6 +110,10 @@ public static void tearDownClass() {
}

_serviceRegistrations.clear();

Registry registry = RegistryUtil.getRegistry();

registry.ungetService(_serviceReference);
}

@Before
Expand Down Expand Up @@ -175,6 +185,8 @@ public void setUp() throws Exception {
extendedProperties.setProperty(
VelocityEngine.VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL,
String.valueOf(!cacheEnabled));
extendedProperties.setProperty(
PortalCacheManagerNames.SINGLE_VM, _singleVMPool);

_velocityEngine.setExtendedProperties(extendedProperties);

Expand Down Expand Up @@ -389,8 +401,10 @@ public void testProcessTemplate8() throws Exception {

private static final String _WRONG_TEMPLATE_ID = "WRONG_TEMPLATE_ID";

private static ServiceReference<SingleVMPool> _serviceReference;
private static final Set<ServiceRegistration<?>> _serviceRegistrations =
Collections.newSetFromMap(new ConcurrentHashMap<>());
private static SingleVMPool _singleVMPool;
private static MockTemplateResourceLoader _templateResourceLoader;

private TemplateContextHelper _templateContextHelper;
Expand Down

0 comments on commit e093a17

Please sign in to comment.