@@ -4814,4 +4814,79 @@ public void testValidationExceptionForMissingRequiredRelationship() throws Excep
48144814
48154815 }
48164816
4817+ /**
4818+ * Method to test: {@link ESContentletAPIImpl#unpublish(Contentlet, User, boolean)}
4819+ * Given Scenario: Unpublish a {@link Contentlet}
4820+ * Expected Result: The modDate field should be updated
4821+ *
4822+ * @throws DotDataException
4823+ */
4824+ @ Test
4825+ public void checkModDateAfterUnpublishContent () throws DotDataException , DotSecurityException {
4826+ final Host host = new SiteDataGen ().nextPersisted ();
4827+ final ContentType contentType = new ContentTypeDataGen ()
4828+ .host (host )
4829+ .nextPersisted ();
4830+ final Contentlet contentlet = new ContentletDataGen (contentType )
4831+ .host (host )
4832+ .nextPersistedAndPublish ();
4833+
4834+ try {
4835+ assertNotNull (contentlet .getModDate ());
4836+ Thread .sleep (500 );
4837+ APILocator .getContentletAPI ().unpublish (contentlet , APILocator .systemUser (), false );
4838+
4839+ final Contentlet contentletByIdentifier = APILocator .getContentletAPI ()
4840+ .findContentletByIdentifier (contentlet .getIdentifier (),
4841+ false , contentlet .getLanguageId (), APILocator .systemUser (), false );
4842+
4843+ assertNotEquals (contentlet .getModDate (), contentletByIdentifier .getModDate ());
4844+ } catch (InterruptedException e ) {
4845+ throw new RuntimeException (e );
4846+ } finally {
4847+ ContentTypeDataGen .remove (contentType );
4848+ ContentletDataGen .remove (contentlet );
4849+ }
4850+
4851+ }
4852+ /**
4853+ * Method to test: {@link ESContentletAPIImpl#archive(Contentlet, User, boolean)}
4854+ * Given Scenario: Archive a {@link Contentlet}
4855+ * Expected Result: The modDate field should be updated
4856+ *
4857+ * @throws DotDataException
4858+ */
4859+ @ Test
4860+ public void checkModDateAfterArchiveContent () throws DotDataException , DotSecurityException {
4861+ final Host host = new SiteDataGen ().nextPersisted ();
4862+ final ContentType contentType = new ContentTypeDataGen ()
4863+ .host (host )
4864+ .nextPersisted ();
4865+ final Contentlet contentlet = new ContentletDataGen (contentType )
4866+ .host (host )
4867+ .nextPersistedAndPublish ();
4868+
4869+ final Date initialModDate = contentlet .getModDate ();
4870+
4871+ try {
4872+ assertNotNull (contentlet .getModDate ());
4873+ Thread .sleep (500 );
4874+ APILocator .getContentletAPI ().archive (contentlet , APILocator .systemUser (), false );
4875+
4876+ final Contentlet contentletByIdentifier = APILocator .getContentletAPI ()
4877+ .findContentletByIdentifier (contentlet .getIdentifier (),
4878+ false , contentlet .getLanguageId (), APILocator .systemUser (), false );
4879+
4880+ final Date finalModDate = contentletByIdentifier .getModDate ();
4881+
4882+ assertNotEquals (initialModDate , finalModDate );
4883+ } catch (InterruptedException e ) {
4884+ throw new RuntimeException (e );
4885+ } finally {
4886+ ContentTypeDataGen .remove (contentType );
4887+ ContentletDataGen .remove (contentlet );
4888+ }
4889+
4890+ }
4891+
48174892}
0 commit comments