use of com.infiniteautomation.mango.spring.service.PublisherService in project ma-core-public by infiniteautomation.
the class MangoTestBase method createMockPublisher.
/**
* Create a publisher
*/
public MockPublisherVO createMockPublisher(boolean enabled) {
MockPublisherVO publisherVO = (MockPublisherVO) ModuleRegistry.getPublisherDefinition(MockPublisherDefinition.TYPE_NAME).baseCreatePublisherVO();
publisherVO.setName(UUID.randomUUID().toString());
publisherVO.setEnabled(enabled);
PublisherService publisherService = Common.getBean(PublisherService.class);
try {
return (MockPublisherVO) publisherService.insert(publisherVO);
} catch (ValidationException e) {
fail(e.getValidationErrorMessage(Common.getTranslations()));
return null;
}
}
use of com.infiniteautomation.mango.spring.service.PublisherService in project ma-core-public by infiniteautomation.
the class MangoTestBase method createMockPublisher.
/**
* Create a publisher with points
*/
public MockPublisherVO createMockPublisher(boolean enabled, List<MockPublishedPointVO> points) {
MockPublisherVO publisherVO = (MockPublisherVO) ModuleRegistry.getPublisherDefinition(MockPublisherDefinition.TYPE_NAME).baseCreatePublisherVO();
publisherVO.setName(UUID.randomUUID().toString());
publisherVO.setEnabled(enabled);
PublisherService publisherService = Common.getBean(PublisherService.class);
try {
MockPublisherVO pub = (MockPublisherVO) publisherService.insert(publisherVO);
PublishedPointService publishedPointService = Common.getBean(PublishedPointService.class);
for (MockPublishedPointVO point : points) {
publishedPointService.insert(point);
}
return pub;
} catch (ValidationException e) {
fail(e.getValidationErrorMessage(Common.getTranslations()));
return null;
}
}
Aggregations