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 testUnsuccessful() {
          EventAdmin eventAdmin = Mockito.mock(EventAdmin.class);
          Distributor distributor = Mockito.mock(Distributor.class);
          DistributionResponse response = Mockito.mock(DistributionResponse.class);
          Mockito.when(response.isSuccessful()).thenReturn(false);
          Mockito.when(response.getState()).thenReturn(DistributionRequestState.DROPPED);
          Mockito.when(response.getMessage()).thenReturn("Like its hot");
          Mockito.when(distributor.distribute(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(response);
          PublicationManager pman = new ContentDistributionPublicationManager(distributor, new String[] { "testagent" },
                  eventAdmin);
          try {
              pman.publish(context.currentResource().adaptTo(Page.class));
              fail();
          } catch (PublicationException pe) {
              assertEquals("Failed to publish: [DROPPED: Like its hot]", pe.getMessage());
          }
      }
test_case.class_method_signature: ContentDistributionPublicationManagerTest.testUnsuccessful()
test_case.full_signature: @Test public void testUnsuccessful()
test_case.identifier: testUnsuccessful
test_case.invocations: mock mock mock thenReturn when isSuccessful thenReturn when getState thenReturn when getMessage thenReturn when distribute any any any publish adaptTo currentResource fail assertEquals getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUnsuccessful()
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 publish(PublishableResource resource) throws PublicationException {
          log.info("Publishing: {}", resource.getPath());
          DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD,
                  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 publish: " + collectFailures(failedResponses));
          } else {
              log.debug("Content Distribution successful, updating publication information");
              super.publish(resource);
          }
      }
focal_method.class_method_signature: ContentDistributionPublicationManager.publish(PublishableResource resource)
focal_method.full_signature: @Override public void publish(PublishableResource resource)
focal_method.identifier: publish
focal_method.invocations: info getPath getPath getPath getContentResource singleton getPath getContentResource distributeRequest getResourceResolver getResource isEmpty collectFailures debug publish
focal_method.modifiers: @Override public
focal_method.parameters: (PublishableResource resource)
focal_method.return: void
focal_method.signature: void publish(PublishableResource resource)