use of com.liferay.ide.portlet.core.lfportlet.model.internal.NumberValueValidationService in project liferay-ide by liferay.
the class LiferayPortletXmlTest method testNumberValidationService.
@Test
public void testNumberValidationService() throws Exception {
if (shouldSkipBundleTests())
return;
LiferayPortletXml liferayPortletApp = LiferayPortletXml.TYPE.instantiate();
LiferayPortlet liferayPortlet = liferayPortletApp.getPortlets().insert();
SchedulerEntry schedulerEntry = liferayPortlet.getSchedulerEntries().insert();
ElementHandle<ITrigger> cronTrigger = ((ElementHandle<ITrigger>) (schedulerEntry.getPortletTrigger()));
ElementHandle<ICronTrigger> cronTriggerValueTrigger = cronTrigger.content(true, CronTrigger.class).getCronTrigger();
CronTriggerValueTrigger cronTriggerValue = cronTriggerValueTrigger.content(true, CronTriggerValueTrigger.class);
NumberValueValidationService vs = cronTriggerValue.getCronTriggerValue().service(NumberValueValidationService.class);
cronTriggerValue.setCronTriggerValue("-1");
assertEquals(false, "ok".equals(vs.validation().message()));
cronTriggerValue.setCronTriggerValue("150");
assertEquals(true, "ok".equals(vs.validation().message()));
}
Aggregations