use of com.day.cq.wcm.msm.api.LiveStatus in project aem-core-wcm-components by Adobe-Marketing-Cloud.
the class ContainerServletTest method setUp.
@BeforeEach
public void setUp() throws WCMException, NoSuchFieldException {
context.load().json(TEST_BASE + CoreComponentTestContext.TEST_CONTENT_JSON, CONTENT_ROOT);
// make the carousel component the current resource
context.currentResource(CAROUSEL_PATH);
// set http method
context.request().setMethod("POST");
// live relationship manager
LiveRelationshipManager liveRelationshipManager = mock(LiveRelationshipManager.class);
when(liveRelationshipManager.getLiveRelationship(any(Resource.class), anyBoolean())).then(invocation -> {
Object[] arguments = invocation.getArguments();
Resource resource = (Resource) arguments[0];
if (LIVE_COPY_PATH.equals(resource.getPath())) {
LiveRelationship liveRelationship = mock(LiveRelationship.class);
LiveStatus liveStatus = mock(LiveStatus.class);
when(liveStatus.isSourceExisting()).thenReturn(true);
when(liveRelationship.getStatus()).thenReturn(liveStatus);
return liveRelationship;
}
return null;
});
FieldSetter.setField(servlet, servlet.getClass().getDeclaredField("liveRelationshipManager"), liveRelationshipManager);
}
Aggregations