You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2020/11/10 19:49:28 UTC

[jspwiki] branch master updated (9406f01 -> 58d0820)

This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git.


    from 9406f01  jbake plugin seems to need JDK 1.8 - this should fix the whole build now..
     new eb9a7c5  Removed unused publishers from Jenkinsfile in order to speed up the CI build.
     new 21db970  fix javadoc
     new b5dda38  JSPWIKI-1131: Ensure latest version of page gets indexed, so changes using VersioningFileProvider get returned by searches
     new 58d0820  2.11.0-M8-git-04

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog.md                                       |  9 +++
 Jenkinsfile                                        |  4 +-
 .../src/main/java/org/apache/wiki/api/Release.java |  2 +-
 .../apache/wiki/tasks/pages/SaveWikiPageTask.java  |  2 +
 .../org/apache/wiki/workflow/AbstractStep.java     |  2 +-
 .../wiki/tasks/pages/SaveWikiPageTaskTest.java     | 93 ++++++++++++++++++++++
 6 files changed, 108 insertions(+), 4 deletions(-)
 create mode 100644 jspwiki-main/src/test/java/org/apache/wiki/tasks/pages/SaveWikiPageTaskTest.java


[jspwiki] 03/04: JSPWIKI-1131: Ensure latest version of page gets indexed, so changes using VersioningFileProvider get returned by searches

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit b5dda3813c66820fdd29e43a593ea178ee837f03
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Nov 10 20:47:04 2020 +0100

    JSPWIKI-1131: Ensure latest version of page gets indexed, so changes using VersioningFileProvider get returned by searches
---
 .../apache/wiki/tasks/pages/SaveWikiPageTask.java  |  2 +
 .../wiki/tasks/pages/SaveWikiPageTaskTest.java     | 93 ++++++++++++++++++++++
 2 files changed, 95 insertions(+)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java b/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
index ffa7947..ef3252c 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/tasks/pages/SaveWikiPageTask.java
@@ -21,6 +21,7 @@ package org.apache.wiki.tasks.pages;
 import org.apache.wiki.api.core.Context;
 import org.apache.wiki.api.core.Page;
 import org.apache.wiki.api.exceptions.WikiException;
+import org.apache.wiki.api.providers.PageProvider;
 import org.apache.wiki.filters.FilterManager;
 import org.apache.wiki.pages.PageManager;
 import org.apache.wiki.render.RenderingManager;
@@ -64,6 +65,7 @@ public class SaveWikiPageTask extends Task {
         context.getEngine().getManager( FilterManager.class ).doPostSaveFiltering( context, proposedText );
 
         // Reindex saved page
+        page.setVersion( PageProvider.LATEST_VERSION );
         context.getEngine().getManager( SearchManager.class ).reindexPage( page );
 
         return Outcome.STEP_COMPLETE;
diff --git a/jspwiki-main/src/test/java/org/apache/wiki/tasks/pages/SaveWikiPageTaskTest.java b/jspwiki-main/src/test/java/org/apache/wiki/tasks/pages/SaveWikiPageTaskTest.java
new file mode 100644
index 0000000..15391a9
--- /dev/null
+++ b/jspwiki-main/src/test/java/org/apache/wiki/tasks/pages/SaveWikiPageTaskTest.java
@@ -0,0 +1,93 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+ */
+package org.apache.wiki.tasks.pages;
+
+import org.apache.wiki.TestEngine;
+import org.apache.wiki.api.core.Context;
+import org.apache.wiki.api.core.Page;
+import org.apache.wiki.api.search.SearchResult;
+import org.apache.wiki.api.spi.Wiki;
+import org.apache.wiki.search.SearchManager;
+import org.apache.wiki.workflow.Outcome;
+import org.apache.wiki.workflow.WorkflowManager;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.concurrent.Callable;
+
+import static org.apache.wiki.TestEngine.with;
+
+public class SaveWikiPageTaskTest {
+
+    @Test
+    public void testSaveWikiPageTask() throws Exception {
+        final TestEngine engine = TestEngine.build( with( "jspwiki.lucene.initialdelay", "0" ),
+                                                    with( "jspwiki.lucene.indexdelay", "1" ) );
+        final String pageName = "TestSaveWikiPageTestPage";
+        final Page page = Wiki.contents().page( engine, pageName );
+        engine.saveText( pageName, "initial text on first revision" );
+        final Context context = Wiki.context().create( engine, engine.newHttpRequest(), page );
+        final SaveWikiPageTask task = new SaveWikiPageTask();
+        task.setWorkflow( 1, new HashMap<>() );
+        task.getWorkflowContext().put( WorkflowManager.WF_WP_SAVE_FACT_PROPOSED_TEXT, "correct horse battery staple" );
+        final Collection< SearchResult > res = new ArrayList<>();
+
+        Assertions.assertEquals( Outcome.STEP_COMPLETE, task.execute( context ) );
+        Awaitility.await( "ensure page gets indexed" ).until( findsResultsFor( context, res, "horse" ) );
+        Assertions.assertEquals( 1, res.size(), "no pages found" );
+        Assertions.assertEquals( pageName, res.iterator().next().getPage().getName(), "page" );
+    }
+
+    @Test
+    public void testSaveWikiPageTaskWithVersioningFileProvider() throws Exception {
+        final TestEngine engine = TestEngine.build( with( "jspwiki.pageProvider", "VersioningFileProvider" ),
+                                                    with( "jspwiki.lucene.initialdelay", "0" ),
+                                                    with( "jspwiki.lucene.indexdelay", "1" ) );
+        final String pageName = "TestSaveWikiPageTestPageWithVersioningFileProvider";
+        final Page page = Wiki.contents().page( engine, pageName );
+        engine.saveText( pageName, "initial text on first revision" );
+        final Context context = Wiki.context().create( engine, engine.newHttpRequest(), page );
+        final SaveWikiPageTask task = new SaveWikiPageTask();
+        task.setWorkflow( 1, new HashMap<>() );
+        task.getWorkflowContext().put( WorkflowManager.WF_WP_SAVE_FACT_PROPOSED_TEXT,
+                                       "It is based on ties of history, culture, language, ethnicity, kinship and geography" );
+        final Collection< SearchResult > res = new ArrayList<>();
+
+        Assertions.assertEquals( Outcome.STEP_COMPLETE, task.execute( context ) );
+        Awaitility.await( "ensure latest version of page gets indexed" ).until( findsResultsFor( context, res, "kinship" ) );
+        Assertions.assertEquals( 1, res.size(), "no pages found" );
+        Assertions.assertEquals( pageName, res.iterator().next().getPage().getName(), "page" );
+    }
+
+    Callable< Boolean > findsResultsFor( final Context context, final Collection< SearchResult > res, final String text ) {
+        return () -> {
+            final Collection< SearchResult > search = context.getEngine().getManager( SearchManager.class ).findPages( text, context );
+            if( search != null && search.size() > 0 ) {
+                res.addAll( search );
+                return true;
+            }
+            return false;
+        };
+    }
+
+}


[jspwiki] 02/04: fix javadoc

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 21db970b132800ac9259d9890fcbf653cd7a4fd1
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Nov 10 20:46:24 2020 +0100

    fix javadoc
---
 jspwiki-main/src/main/java/org/apache/wiki/workflow/AbstractStep.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jspwiki-main/src/main/java/org/apache/wiki/workflow/AbstractStep.java b/jspwiki-main/src/main/java/org/apache/wiki/workflow/AbstractStep.java
index d4d16b6..acf4431 100644
--- a/jspwiki-main/src/main/java/org/apache/wiki/workflow/AbstractStep.java
+++ b/jspwiki-main/src/main/java/org/apache/wiki/workflow/AbstractStep.java
@@ -26,7 +26,7 @@ import java.security.Principal;
 import java.util.*;
 
 /**
- * Abstract superclass that provides a complete implementation of most Step methods; subclasses need only implement {@link #execute()} and
+ * Abstract superclass that provides a complete implementation of most Step methods; subclasses need only implement {@link #execute(Context)} and
  * {@link #getActor()}.
  *
  * @since 2.5


[jspwiki] 04/04: 2.11.0-M8-git-04

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit 58d0820bf0185744e645c00d74e6ae246c8c91ca
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Nov 10 20:48:55 2020 +0100

    2.11.0-M8-git-04
---
 ChangeLog.md                                               | 9 +++++++++
 jspwiki-api/src/main/java/org/apache/wiki/api/Release.java | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index f120de6..53d5006 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -17,6 +17,15 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+**2020-11-10  Juan Pablo Santos (juanpablo AT apache DOT org)**
+
+* _2.11.0-M8-git-04_
+
+* [JSPWIKI-1131](https://issues.apache.org/jira/browse/JSPWIKI-1131): Lucene Index not updated on edits/new page
+    * Ensure latest version of page gets indexed, so changes using `VersioningFileProvider` get returned by searches.
+
+* Removed unused publishers from `Jenkinsfile` in order to speed up the CI build.
+
 **2020-11-07  Juan Pablo Santos (juanpablo AT apache DOT org)**
 
 * _2.11.0-M8-git-03_
diff --git a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
index 9f58709..9967d16 100644
--- a/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
+++ b/jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
@@ -69,7 +69,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "git-03";
+    public static final String     BUILD         = "git-04";
 
     /**
      *  This is the generic version string you should use when printing out the version.  It is of


[jspwiki] 01/04: Removed unused publishers from Jenkinsfile in order to speed up the CI build.

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juanpablo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jspwiki.git

commit eb9a7c525a89858fcfff0d64802bcef8edacadfc
Author: juanpablo <ju...@apache.org>
AuthorDate: Tue Nov 10 20:46:02 2020 +0100

    Removed unused publishers from Jenkinsfile in order to speed up the CI build.
---
 Jenkinsfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 58f3954..4674164 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -37,7 +37,7 @@ try {
         stage( 'build source' ) {
             dir( build ) {
                 git url: buildRepo, poll: true
-                withMaven( jdk: buildJdk, maven: buildMvn ) {
+                withMaven( jdk: buildJdk, maven: buildMvn, publisherStrategy: 'EXPLICIT', options: [ jacocoPublisher(), junitPublisher() ] ) {
                     withCredentials( [ string( credentialsId: 'sonarcloud-jspwiki', variable: 'SONAR_TOKEN' ) ] ) {
                         def sonarOptions = "-Dsonar.projectKey=jspwiki-builder -Dsonar.organization=apache -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN"
                         echo 'Will use SonarQube instance at https://sonarcloud.io'
@@ -53,7 +53,7 @@ try {
         }
 
         stage( 'build website' ) {
-            withMaven( jdk: 'jdk_1.8_latest', maven: buildMvn ) {
+            withMaven( jdk: 'jdk_1.8_latest', maven: buildMvn, publisherStrategy: 'EXPLICIT' ) {
                 dir( jbake ) {
                     git branch: jbake, url: siteRepo, credentialsId: creds, poll: false
                     sh "cp ../$build/ChangeLog.md ./src/main/config/changelog.md"