From 11e4c53175413bc0fb64cef0409c207aca20e7c5 Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <yannick.lecaillez@forgerock.com>
Date: Tue, 11 Oct 2016 15:26:04 +0000
Subject: [PATCH] Fix build issues from OPENDJ-3230-3223 fix.

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java     |    2 +-
 opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java |   34 +++++++++++++++++++++++-----------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java
index 9d82d70..e4be866 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/OnDiskMergeImporter.java
@@ -516,7 +516,7 @@
       {
         // Name could be a (attributeType)((.indexType)|(.matchingRule))
         // Add a trailing "." to ensure that resulting parts has always at least two parts.
-        final String parts[] = (name + ".").split("\\.");
+        final String parts[] = (name + ".*").split("\\.");
 
         // Is name represents all VLV index ?
         final SelectIndexName selector = new SelectIndexName();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java
index 41bdc43..a87e9e7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/OnDiskMergeImporterTest.java
@@ -199,34 +199,46 @@
     };
   }
 
-  @Test(dataProvider="expandIndexData")
+  @Test(dataProvider = "expandIndexData")
   public void testCanExpandIndexNames(final String[] indexNames, final String[] expectedExpandedIndexNames)
-      throws InitializationException {
+      throws InitializationException
+  {
     final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
     assertThat(strategy.expandIndexNames(entryContainer, asList(indexNames)))
       .containsExactlyInAnyOrder(expectedExpandedIndexNames);
   }
 
-  @Test(expectedExceptions=InitializationException.class)
-  public void testThrowOnUnindexedType() throws InitializationException {
+  @Test
+  public void testIgnoreUnindexedType() throws InitializationException
+  {
     final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
-    strategy.expandIndexNames(entryContainer, asList(".approximate"));
+    assertThat(strategy.expandIndexNames(entryContainer, asList(".approximate"))).isEmpty();
   }
 
-  @Test(expectedExceptions=InitializationException.class)
-  public void testThrowOnUnrecognizedMatchingRule() throws InitializationException {
+  @Test
+  public void testIgnoreUnindexedMatchingRule() throws InitializationException
+  {
+    final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
+    assertThat(strategy.expandIndexNames(entryContainer, asList(".IntegerFirstComponentMatch"))).isEmpty();
+  }
+
+  @Test(expectedExceptions = InitializationException.class)
+  public void testThrowOnUnrecognizedSecondPart() throws InitializationException
+  {
     final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
     strategy.expandIndexNames(entryContainer, asList(".unknown"));
   }
 
-  @Test(expectedExceptions=InitializationException.class)
-  public void testThrowOnUnrecognizedAttribute() throws InitializationException {
+  @Test(expectedExceptions = InitializationException.class)
+  public void testThrowOnUnrecognizedAttributeType() throws InitializationException
+  {
     final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
     strategy.expandIndexNames(entryContainer, asList("unknown"));
   }
 
-  @Test(expectedExceptions=InitializationException.class)
-  public void testThrowOnUnrecognizedVlvIndex() throws InitializationException {
+  @Test(expectedExceptions = InitializationException.class)
+  public void testThrowOnUnrecognizedVlvIndex() throws InitializationException
+  {
     final StrategyImpl strategy = new StrategyImpl(serverContext, backend.getRootContainer(), backendCfg);
     strategy.expandIndexNames(entryContainer, asList("vlv.unknown"));
   }

--
Gitblit v1.10.0