test_class.declarator: context = new SlingContext()
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final SlingContext context = new SlingContext();
test_class.type: SlingContext
test_class.var_name: context
test_class.file: core/src/test/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManagerTest.java
test_class.identifier: ContentDistributionPublicationManagerTest
test_case.body: @Test
      public void testUnpublish() throws PublicationException {
          EventAdmin eventAdmin = Mockito.mock(EventAdmin.class);
          Distributor distributor = Mockito.mock(Distributor.class);
          DistributionResponse response = Mockito.mock(DistributionResponse.class);
          Mockito.when(response.isSuccessful()).thenReturn(true);
          Mockito.when(distributor.distribute(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(response);
          PublicationManager pman = new ContentDistributionPublicationManager(distributor, new String[] { "testagent" },
                  eventAdmin);
  
          pman.unpublish(context.currentResource().adaptTo(Page.class));
          Mockito.verify(distributor).distribute(Mockito.eq("testagent"), Mockito.any(ResourceResolver.class),
                  Mockito.any());
          Mockito.verify(eventAdmin).postEvent(Mockito.any());
          ValueMap properties = context.currentResource().getChild("jcr:content").getValueMap();
          assertEquals(false, properties.get(CMSConstants.PN_PUBLISHED, Boolean.class));
          assertEquals("DELETE", properties.get(CMSConstants.PN_LAST_PUBLICATION_TYPE, String.class));
      }
test_case.class_method_signature: ContentDistributionPublicationManagerTest.testUnpublish()
test_case.full_signature: @Test public void testUnpublish()
test_case.identifier: testUnpublish
test_case.invocations: mock mock mock thenReturn when isSuccessful thenReturn when distribute any any any unpublish adaptTo currentResource distribute verify eq any any postEvent verify any getValueMap getChild currentResource assertEquals get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUnpublish()
focal_class.declarator: log = LoggerFactory.getLogger(ContentDistributionPublicationManager.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(ContentDistributionPublicationManager.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: distributor
focal_class.modifier: private final
focal_class.original_string: private final Distributor distributor;
focal_class.type: Distributor
focal_class.var_name: distributor
focal_class.declarator: agents
focal_class.modifier: private final
focal_class.original_string: private final String[] agents;
focal_class.type: String[]
focal_class.var_name: agents
focal_class.file: core/src/main/java/org/apache/sling/cms/core/publication/ContentDistributionPublicationManager.java
focal_class.identifier: ContentDistributionPublicationManager
focal_class.class_method_signature: ContentDistributionPublicationManager.ContentDistributionPublicationManager(Distributor distributor, String[] agents, EventAdmin eventAdmin)
focal_class.full_signature: public  ContentDistributionPublicationManager(Distributor distributor, String[] agents, EventAdmin eventAdmin)
focal_class.identifier: ContentDistributionPublicationManager
focal_class.modifiers: public
focal_class.parameters: (Distributor distributor, String[] agents, EventAdmin eventAdmin)
focal_class.signature:  ContentDistributionPublicationManager(Distributor distributor, String[] agents, EventAdmin eventAdmin)
focal_class.class_method_signature: ContentDistributionPublicationManager.publish(PublishableResource resource)
focal_class.full_signature: @Override public void publish(PublishableResource resource)
focal_class.identifier: publish
focal_class.modifiers: @Override public
focal_class.parameters: (PublishableResource resource)
focal_class.return: void
focal_class.signature: void publish(PublishableResource resource)
focal_class.class_method_signature: ContentDistributionPublicationManager.collectFailures(List<DistributionResponse> failedResponses)
focal_class.full_signature: private String collectFailures(List<DistributionResponse> failedResponses)
focal_class.identifier: collectFailures
focal_class.modifiers: private
focal_class.parameters: (List<DistributionResponse> failedResponses)
focal_class.return: String
focal_class.signature: String collectFailures(List<DistributionResponse> failedResponses)
focal_class.class_method_signature: ContentDistributionPublicationManager.distributeRequest(ResourceResolver resolver, DistributionRequest request)
focal_class.full_signature: private List<DistributionResponse> distributeRequest(ResourceResolver resolver, DistributionRequest request)
focal_class.identifier: distributeRequest
focal_class.modifiers: private
focal_class.parameters: (ResourceResolver resolver, DistributionRequest request)
focal_class.return: List<DistributionResponse>
focal_class.signature: List<DistributionResponse> distributeRequest(ResourceResolver resolver, DistributionRequest request)
focal_class.class_method_signature: ContentDistributionPublicationManager.unpublish(PublishableResource resource)
focal_class.full_signature: @Override public void unpublish(PublishableResource resource)
focal_class.identifier: unpublish
focal_class.modifiers: @Override public
focal_class.parameters: (PublishableResource resource)
focal_class.return: void
focal_class.signature: void unpublish(PublishableResource resource)
focal_class.class_method_signature: ContentDistributionPublicationManager.getPublicationMode()
focal_class.full_signature: @Override public PUBLICATION_MODE getPublicationMode()
focal_class.identifier: getPublicationMode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: PUBLICATION_MODE
focal_class.signature: PUBLICATION_MODE getPublicationMode()
focal_class.superclass: extends StandalonePublicationManager
focal_method.body: @Override
      public void unpublish(PublishableResource resource) throws PublicationException {
          log.info("Unpublish: {}", resource.getPath());
          DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.DELETE,
                  new String[] { resource.getPath(), resource.getContentResource().getPath() },
                  Collections.singleton(resource.getContentResource().getPath()));
          List<DistributionResponse> failedResponses = this
                  .distributeRequest(resource.getResource().getResourceResolver(), request);
          if (!failedResponses.isEmpty()) {
              throw new PublicationException("Failed to unpublish: " + collectFailures(failedResponses));
          } else {
              super.unpublish(resource);
          }
      }
focal_method.class_method_signature: ContentDistributionPublicationManager.unpublish(PublishableResource resource)
focal_method.full_signature: @Override public void unpublish(PublishableResource resource)
focal_method.identifier: unpublish
focal_method.invocations: info getPath getPath getPath getContentResource singleton getPath getContentResource distributeRequest getResourceResolver getResource isEmpty collectFailures unpublish
focal_method.modifiers: @Override public
focal_method.parameters: (PublishableResource resource)
focal_method.return: void
focal_method.signature: void unpublish(PublishableResource resource)