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 5b6a8a691d6f77ff477c9883a3d7f7acb46f7c54 Author: AF090536 <[email protected]> AuthorDate: Mon Feb 22 16:40:39 2021 +0100 Added some more unit testing --- .../wiki/search/kendra/KendraSearchProvider.java | 19 +- .../search/kendra/KendraSearchProviderTest.java | 248 +++++++++++++++------ .../org/apache/wiki/search/kendra/WithKendra.java | 34 +++ .../org/apache/wiki/search/kendra/WithPage.java | 38 ++++ .../org/apache/wiki/search/kendra/WithPages.java | 33 +++ .../org/apache/wiki/search/kendra/WithResult.java | 40 ++++ .../org/apache/wiki/search/kendra/WithResults.java | 33 +++ .../src/test/resources/jspwiki-custom.properties | 10 +- 8 files changed, 382 insertions(+), 73 deletions(-) diff --git a/jspwiki-kendra-searchprovider/src/main/java/org/apache/wiki/search/kendra/KendraSearchProvider.java b/jspwiki-kendra-searchprovider/src/main/java/org/apache/wiki/search/kendra/KendraSearchProvider.java index e032e32..cbf87d3 100644 --- a/jspwiki-kendra-searchprovider/src/main/java/org/apache/wiki/search/kendra/KendraSearchProvider.java +++ b/jspwiki-kendra-searchprovider/src/main/java/org/apache/wiki/search/kendra/KendraSearchProvider.java @@ -137,8 +137,10 @@ public class KendraSearchProvider implements SearchProvider { // Start the Kendra update thread, which waits first for a little while // before starting to go through the "pages that need updating". - KendraUpdater updater = new KendraUpdater(engine, this, initialDelay, indexDelay); - updater.start(); + if (initialDelay >= 0) { + KendraUpdater updater = new KendraUpdater(engine, this, initialDelay, indexDelay); + updater.start(); + } } private Map<String, Object> getContentTypes() { @@ -266,7 +268,11 @@ public class KendraSearchProvider implements SearchProvider { ListIndicesResult result = getKendra().listIndices(request); String nextToken = ""; while (nextToken != null) { - for (IndexConfigurationSummary item : result.getIndexConfigurationSummaryItems()) { + List<IndexConfigurationSummary> items = result.getIndexConfigurationSummaryItems(); + if (items == null || items.isEmpty()) { + return null; + } + for (IndexConfigurationSummary item : items) { if (StringUtils.equals(item.getName(), indexName)) { return item.getId(); } @@ -290,7 +296,12 @@ public class KendraSearchProvider implements SearchProvider { ListDataSourcesResult result = getKendra().listDataSources(request); String nextToken = ""; while (nextToken != null) { - for (DataSourceSummary item : result.getSummaryItems()) { + List<DataSourceSummary> items = result.getSummaryItems(); + if (items == null || items.isEmpty()) { + return null; + } + + for (DataSourceSummary item : items) { if (StringUtils.equals(item.getName(), dataSourceName)) { return item.getId(); } diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/KendraSearchProviderTest.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/KendraSearchProviderTest.java index bc0e6fc..d4627f4 100644 --- a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/KendraSearchProviderTest.java +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/KendraSearchProviderTest.java @@ -17,27 +17,37 @@ package org.apache.wiki.search.kendra; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; import static org.mockito.Mockito.lenient; +import static org.mockito.Mockito.when; +import java.io.IOException; +import java.lang.reflect.Method; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; +import java.util.List; import java.util.Properties; +import java.util.UUID; import java.util.concurrent.Callable; -import org.apache.log4j.Logger; import org.apache.wiki.TestEngine; import org.apache.wiki.api.core.Context; import org.apache.wiki.api.core.ContextEnum; -import org.apache.wiki.api.core.Engine; +import org.apache.wiki.api.exceptions.WikiException; import org.apache.wiki.api.search.SearchResult; import org.apache.wiki.api.spi.Wiki; import org.apache.wiki.search.SearchManager; import org.awaitility.Awaitility; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.platform.commons.util.StringUtils; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; import org.mockito.junit.jupiter.MockitoExtension; @@ -68,65 +78,66 @@ import net.sourceforge.stripes.mock.MockHttpServletRequest; @ExtendWith(MockitoExtension.class) public class KendraSearchProviderTest { - private static final Logger LOG = Logger.getLogger(KendraSearchProviderTest.class); - TestEngine engine; Properties props; - KendraSearchProvider ksp; + KendraSearchProvider searchProvider; @Mock AWSkendra kendraMock; @BeforeEach - void setUp() throws Exception { + void setUp(TestInfo testInfo) throws Exception { props = TestEngine.getTestProperties(); TestEngine.emptyWorkDir(props); CacheManager.getInstance().removeAllCaches(); engine = new TestEngine(props); - try { - setupAWSKendra(engine); - } catch (Exception e) { - LOG.error(e.toString()); + + // before each test I setup the Kendra Client + searchProvider = (KendraSearchProvider) engine.getManager(SearchManager.class).getSearchEngine(); + Method m = testInfo.getTestMethod().get(); + String indexName = null; + String dataSourceName = null; + if (m.isAnnotationPresent(WithKendra.class)) { + WithKendra withKendra = m.getAnnotation(WithKendra.class); + indexName = withKendra.indexName(); + dataSourceName = withKendra.dataSourceName(); + setUpKendraMock(indexName, dataSourceName); + searchProvider.setKendra(kendraMock); + if (StringUtils.isNotBlank(indexName) && StringUtils.isNotBlank(dataSourceName)) { + searchProvider.initializeIndexAndDataSource(); + } + } else { + setUpKendraMock(null, null); + searchProvider.setKendra(kendraMock); + } + // And possibly the pages that will be present in the wiki + if (m.isAnnotationPresent(WithPages.class)) { + WithPages withPages = m.getAnnotation(WithPages.class); + addPages(withPages.value()); + } + if (m.isAnnotationPresent(WithPage.class)) { + WithPage withPage = m.getAnnotation(WithPage.class); + addPages(withPage); + } + // and the corresponding search results + if (m.isAnnotationPresent(WithResults.class)) { + WithResults withResults = m.getAnnotation(WithResults.class); + addResults(withResults.value()); + } + if(m.isAnnotationPresent(WithResult.class)) { + WithResult withResult = m.getAnnotation(WithResult.class); + addResults(withResult); } } - private void setupAWSKendra(Engine engine) throws InterruptedException { - ksp = (KendraSearchProvider) engine.getManager(SearchManager.class).getSearchEngine(); - when(kendraMock.listIndices(any(ListIndicesRequest.class))).then(new Answer<ListIndicesResult>() { - @Override - public ListIndicesResult answer(InvocationOnMock invocation) throws Throwable { - return new ListIndicesResult().withIndexConfigurationSummaryItems( - new IndexConfigurationSummary().withId("IndexId").withName(ksp.getIndexName())); - } - }); - lenient().when(kendraMock.listDataSources(any(ListDataSourcesRequest.class))).then(new Answer<ListDataSourcesResult>() { - @Override - public ListDataSourcesResult answer(InvocationOnMock invocation) throws Throwable { - return new ListDataSourcesResult() - .withSummaryItems(new DataSourceSummary().withId("DataSourceId").withName(ksp.getDataSourceName())); - } - }); - lenient().when(kendraMock.startDataSourceSyncJob(any(StartDataSourceSyncJobRequest.class))).then(new Answer<StartDataSourceSyncJobResult>() { - @Override - public StartDataSourceSyncJobResult answer(InvocationOnMock invocation) throws Throwable { - return new StartDataSourceSyncJobResult().withExecutionId("executionId"); - } - }); - lenient().when(kendraMock.batchPutDocument(any(BatchPutDocumentRequest.class))).then(new Answer<BatchPutDocumentResult>() { - @Override - public BatchPutDocumentResult answer(InvocationOnMock invocation) throws Throwable { - return new BatchPutDocumentResult().withFailedDocuments(new ArrayList<>()); - } - }); - lenient().when(kendraMock.query(any(QueryRequest.class))).then(new Answer<QueryResult>() { - @Override - public QueryResult answer(InvocationOnMock invocation) throws Throwable { - return new QueryResult().withResultItems(new ArrayList<>()); - } - }); - - ksp.setKendra(kendraMock); - ksp.initializeIndexAndDataSource(); + @AfterEach + void tearDown(TestInfo testInfo) throws Exception { + Method m = testInfo.getTestMethod().get(); + // And possibly the pages that will be present in the wiki + if (m.isAnnotationPresent(WithPage.class)) { + WithPage withPage = m.getAnnotation(WithPage.class); + engine.deleteTestPage(withPage.name()); + } } void debugSearchResults(final Collection<SearchResult> res) { @@ -142,8 +153,8 @@ public class KendraSearchProviderTest { return () -> { final MockHttpServletRequest request = engine.newHttpRequest(); final Context ctx = Wiki.context().create(engine, request, ContextEnum.PAGE_EDIT.getRequestContext()); - final Collection<SearchResult> searchResults = ksp.findPages(text, ctx); - if (searchResults != null && searchResults.size() > 0) { + final Collection<SearchResult> searchResults = searchProvider.findPages(text, ctx); + if (searchResults != null && !searchResults.isEmpty()) { debugSearchResults(searchResults); res.addAll(searchResults); return true; @@ -153,26 +164,137 @@ public class KendraSearchProviderTest { } @Test + public void testInvalidIndexName() throws Exception { + // IndexName is invalid... + Assertions.assertThrows(IllegalArgumentException.class, () -> { + searchProvider.initializeIndexAndDataSource(); + }); + } + + @Test + @WithKendra(indexName = "JSPWikiIndex", dataSourceName = "") + public void testInvalidDataSourceName() throws Exception { + // IndexName is invalid... + Assertions.assertThrows(IllegalArgumentException.class, () -> { + searchProvider.initializeIndexAndDataSource(); + }); + } + + @Test + @WithKendra(indexName = "JSPWikiIndex", dataSourceName = "JSPWikiDataSource") + @WithPage(name = "TestPage", text = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.", attachments = {}) + public void testSearchNoResult() throws Exception { + final Collection<SearchResult> res = new ArrayList<>(); + Assertions.assertFalse(findsResultsFor(res, "this text does not exists").call()); + Assertions.assertEquals(0, res.size(), "has result. none were expected"); + } + + @Test + @WithKendra(indexName = "JSPWikiIndex", dataSourceName = "JSPWikiDataSource") + @WithPage(name = "TestPage", text = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.", attachments = {}) + @WithResult(name = "TestPage", text = "mankind", scoreConfidence = ScoreConfidence.VERY_HIGH) public void testSimpleSearch() throws Exception { - final String txt = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War."; - engine.saveText("TestPage", txt); - addTestresult("TestPage", "mankind", ScoreConfidence.VERY_HIGH); final Collection<SearchResult> res = new ArrayList<>(); Awaitility.await("testSimpleSearch").until(findsResultsFor(res, "mankind")); - Assertions.assertEquals(1, res.size(), "no pages"); - Assertions.assertEquals("TestPage", res.iterator().next().getPage().getName(), "page"); - engine.deleteTestPage("TestPage"); + Assertions.assertEquals(1, res.size(), "no pages. one was expectd"); + Assertions.assertEquals("TestPage", res.iterator().next().getPage().getName(), "the page TestPage was expected"); + } + + @Test + @WithKendra(indexName = "JSPWikiIndex", dataSourceName = "JSPWikiDataSource") + @WithPage(name = "TestPage", text = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.", attachments = {}) + @WithPage(name = "TestPage2", text = "It was the dawn of the third age of mankind, ten years after the Earth-Minbari War.", attachments = {}) + @WithResult(name = "TestPage", text = "mankind", scoreConfidence = ScoreConfidence.VERY_HIGH) + @WithResult(name = "TestPage2", text = "mankind", scoreConfidence = ScoreConfidence.VERY_HIGH) + public void testSimpleSearch2() throws Exception { + final Collection<SearchResult> res = new ArrayList<>(); + Awaitility.await("testSimpleSearch2").until(findsResultsFor(res, "mankind")); + Assertions.assertEquals(2, res.size(), "2 pages were expectd"); + Iterator<SearchResult> i = res.iterator(); + Assertions.assertEquals("TestPage", i.next().getPage().getName(), "the page TestPage was expected"); + Assertions.assertEquals("TestPage2", i.next().getPage().getName(), "the page TestPage2 was expected"); } - - private void addTestresult(String pageName, String pageContent, ScoreConfidence scoreConfidence ) { + + private void setUpKendraMock(String indexName, String dataSourceName) throws Exception { + final String indexId = UUID.randomUUID().toString(); + final String dataSourceId = UUID.randomUUID().toString(); + when(kendraMock.listIndices(any(ListIndicesRequest.class))).then(new Answer<ListIndicesResult>() { + @Override + public ListIndicesResult answer(InvocationOnMock invocation) throws Throwable { + ListIndicesResult result = new ListIndicesResult(); + if (StringUtils.isNotBlank(indexName)) { + result + .withIndexConfigurationSummaryItems(new IndexConfigurationSummary().withId(indexId).withName(indexName)); + } + return result; + } + }); + lenient().when(kendraMock.listDataSources(any(ListDataSourcesRequest.class))) + .then(new Answer<ListDataSourcesResult>() { + @Override + public ListDataSourcesResult answer(InvocationOnMock invocation) throws Throwable { + ListDataSourcesResult result = new ListDataSourcesResult(); + if (StringUtils.isNotBlank(dataSourceName)) { + result.withSummaryItems(new DataSourceSummary().withId(dataSourceId).withName(dataSourceName)); + } + return result; + } + }); + lenient().when(kendraMock.startDataSourceSyncJob(any(StartDataSourceSyncJobRequest.class))) + .then(new Answer<StartDataSourceSyncJobResult>() { + @Override + public StartDataSourceSyncJobResult answer(InvocationOnMock invocation) throws Throwable { + return new StartDataSourceSyncJobResult().withExecutionId("executionId"); + } + }); + lenient().when(kendraMock.batchPutDocument(any(BatchPutDocumentRequest.class))) + .then(new Answer<BatchPutDocumentResult>() { + @Override + public BatchPutDocumentResult answer(InvocationOnMock invocation) throws Throwable { + BatchPutDocumentResult result = new BatchPutDocumentResult(); + result.withFailedDocuments(new ArrayList<>()); + return result; + } + }); + lenient().when(kendraMock.query(any(QueryRequest.class))).then(new Answer<QueryResult>() { + @Override + public QueryResult answer(InvocationOnMock invocation) throws Throwable { + QueryResult result = new QueryResult(); + result.withResultItems(new ArrayList<>()); + return result; + } + }); + } + + private void addPages(final WithPage... withPages) + throws WikiException, IOException, URISyntaxException { + for (WithPage withPage : withPages ) { + String name = withPage.name(); + String text = withPage.text(); + String[] attachements = withPage.attachments(); + engine.saveText(name, text); + ClassLoader classLoader = KendraSearchProviderTest.class.getClassLoader(); + for (String attachement : attachements) { + byte[] content = Files.readAllBytes(Paths.get(classLoader.getResource(attachement).toURI())); + engine.addAttachment(name, attachement, content); + } + } + } + + private void addResults(final WithResult... withResults) { when(kendraMock.query(any(QueryRequest.class))).then(new Answer<QueryResult>() { @Override public QueryResult answer(InvocationOnMock invocation) throws Throwable { - QueryResultItem item = new QueryResultItem().withId(pageName).withType(QueryResultType.DOCUMENT); - item.withDocumentTitle(new TextWithHighlights().withText(pageName)); - item.withDocumentExcerpt(new TextWithHighlights().withText(pageContent)); - item.withScoreAttributes(new ScoreAttributes().withScoreConfidence(scoreConfidence)); - return new QueryResult().withResultItems(item); + List<QueryResultItem> items = new ArrayList<>(); + for (WithResult withResult : withResults) { + QueryResultItem item = new QueryResultItem().withType(QueryResultType.DOCUMENT); + item.withDocumentId(withResult.name()); + item.withDocumentTitle(new TextWithHighlights().withText(withResult.name())); + item.withDocumentExcerpt(new TextWithHighlights().withText(withResult.text())); + item.withScoreAttributes(new ScoreAttributes().withScoreConfidence(withResult.scoreConfidence())); + items.add(item); + } + return new QueryResult().withResultItems(items); } }); } diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithKendra.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithKendra.java new file mode 100644 index 0000000..39c297a --- /dev/null +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithKendra.java @@ -0,0 +1,34 @@ +/* + * 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.search.kendra; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Target({METHOD}) +@Retention(RUNTIME) +@Documented +public @interface WithKendra { + + String indexName(); // JSPWikiIndex + + String dataSourceName(); // JSPWikiDataSource +} diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPage.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPage.java new file mode 100644 index 0000000..c8b1f8c --- /dev/null +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPage.java @@ -0,0 +1,38 @@ +/* + * 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.search.kendra; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Target({METHOD}) +@Retention(RUNTIME) +@Documented +@Repeatable(WithPages.class) +public @interface WithPage { + + String name() default "Main"; + + String text() default "Sample Text"; + + String[] attachments() default {}; +} diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPages.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPages.java new file mode 100644 index 0000000..d467c7b --- /dev/null +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithPages.java @@ -0,0 +1,33 @@ +/* + * 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.search.kendra; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Target({METHOD}) +@Retention(RUNTIME) +@Documented +public @interface WithPages { + + WithPage[] value(); + +} diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResult.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResult.java new file mode 100644 index 0000000..ae9be07 --- /dev/null +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResult.java @@ -0,0 +1,40 @@ +/* + * 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.search.kendra; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import com.amazonaws.services.kendra.model.ScoreConfidence; + +@Target({ METHOD }) +@Retention(RUNTIME) +@Documented +@Repeatable(WithResults.class) +public @interface WithResult { + + String name(); + + String text(); + + ScoreConfidence scoreConfidence(); +} diff --git a/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResults.java b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResults.java new file mode 100644 index 0000000..617d40f --- /dev/null +++ b/jspwiki-kendra-searchprovider/src/test/java/org/apache/wiki/search/kendra/WithResults.java @@ -0,0 +1,33 @@ +/* + * 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.search.kendra; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Target({METHOD}) +@Retention(RUNTIME) +@Documented +public @interface WithResults { + + WithResult[] value(); + +} diff --git a/jspwiki-kendra-searchprovider/src/test/resources/jspwiki-custom.properties b/jspwiki-kendra-searchprovider/src/test/resources/jspwiki-custom.properties index d4838fe..4735511 100644 --- a/jspwiki-kendra-searchprovider/src/test/resources/jspwiki-custom.properties +++ b/jspwiki-kendra-searchprovider/src/test/resources/jspwiki-custom.properties @@ -21,12 +21,10 @@ jspwiki.fileSystemProvider.pageDir = target/test-classes/testrepository jspwiki.workDir = target/test-classes/testworkdir jspwiki.searchProvider = org.apache.wiki.search.kendra.KendraSearchProvider -jspwiki.kendra.indexName = JSPWikiPageIndex -jspwiki.kendra.indexRoleArn = arn:aws:iam::123456789012:role/IndexRoleArn -jspwiki.kendra.dataSourceName = JSPWikiPageDataSource -jspwiki.kendra.dataSourceRoleArn = arn:aws:iam::123456789012:role/DataSourceRoleArn -jspwiki.kendra.initialdelay = 1 -jspwiki.kendra.indexdelay = 1 +jspwiki.kendra.indexName = JSPWikiIndex +jspwiki.kendra.dataSourceName = JSPWikiDataSource +jspwiki.kendra.initialdelay = -1 +jspwiki.kendra.indexdelay = -1 jspwiki.translatorReader.camelCaseLinks = true jspwiki.breakTitleWithSpaces = true
