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/StandalonePublicationManagerTest.java
test_class.identifier: StandalonePublicationManagerTest
test_case.body: @Test
      public void testPublish() throws PublicationException {
          EventAdmin eventAdmin = Mockito.mock(EventAdmin.class);
          PublicationManager pman = new StandalonePublicationManager(eventAdmin);
  
          context.currentResource("/content/apache/sling-apache-org/index");
  
          pman.publish(context.currentResource().adaptTo(Page.class));
  
          Mockito.verify(eventAdmin).postEvent(Mockito.any());
          ValueMap properties = context.currentResource().getChild("jcr:content").getValueMap();
          assertEquals(true, properties.get(CMSConstants.PN_PUBLISHED, Boolean.class));
          assertEquals("ADD", properties.get(CMSConstants.PN_LAST_PUBLICATION_TYPE, String.class));
      }
test_case.class_method_signature: StandalonePublicationManagerTest.testPublish()
test_case.full_signature: @Test public void testPublish()
test_case.identifier: testPublish
test_case.invocations: mock currentResource publish adaptTo currentResource 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 testPublish()
focal_class.declarator: eventAdmin
focal_class.modifier: private
focal_class.original_string: private EventAdmin eventAdmin;
focal_class.type: EventAdmin
focal_class.var_name: eventAdmin
focal_class.file: core/src/main/java/org/apache/sling/cms/core/publication/StandalonePublicationManager.java
focal_class.identifier: StandalonePublicationManager
focal_class.interfaces: implements PublicationManager
focal_class.class_method_signature: StandalonePublicationManager.StandalonePublicationManager(EventAdmin eventAdmin)
focal_class.full_signature: public  StandalonePublicationManager(EventAdmin eventAdmin)
focal_class.identifier: StandalonePublicationManager
focal_class.modifiers: public
focal_class.parameters: (EventAdmin eventAdmin)
focal_class.signature:  StandalonePublicationManager(EventAdmin eventAdmin)
focal_class.class_method_signature: StandalonePublicationManager.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: StandalonePublicationManager.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: StandalonePublicationManager.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_method.body: @Override
      public void publish(PublishableResource resource) throws PublicationException {
          try {
              ModifiableValueMap properties = Optional
                      .ofNullable(resource.getContentResource().adaptTo(ModifiableValueMap.class))
                      .orElseThrow(() -> new PublicationException("Cannot modify resource"));
              properties.put(CMSConstants.PN_PUBLISHED, true);
              properties.put(CMSConstants.PN_LAST_PUBLICATION, Calendar.getInstance());
              properties.put(CMSConstants.PN_LAST_PUBLICATION_TYPE, PublicationType.ADD.toString());
              resource.getResource().getResourceResolver().commit();
  
              eventAdmin.postEvent(PublicationEvent.publish(resource, false));
          } catch (PersistenceException e) {
              throw new PublicationException("Cannot save publication status", e);
          }
      }
focal_method.class_method_signature: StandalonePublicationManager.publish(PublishableResource resource)
focal_method.full_signature: @Override public void publish(PublishableResource resource)
focal_method.identifier: publish
focal_method.invocations: orElseThrow ofNullable adaptTo getContentResource put put getInstance put toString commit getResourceResolver getResource postEvent publish
focal_method.modifiers: @Override public
focal_method.parameters: (PublishableResource resource)
focal_method.return: void
focal_method.signature: void publish(PublishableResource resource)