Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2975 [created] 313febd9e


GEODE-2975: Change the location of the lucene xsd

The lucene xsd was not in the right location on disk, which resulted in
a failure to validate lucene elements in the xml file.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/313febd9
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/313febd9
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/313febd9

Branch: refs/heads/feature/GEODE-2975
Commit: 313febd9eb1cc2b89ab790d00183010b9d5d27b2
Parents: c793f74
Author: Dan Smith <[email protected]>
Authored: Thu May 25 13:05:23 2017 -0700
Committer: Dan Smith <[email protected]>
Committed: Thu May 25 13:05:23 2017 -0700

----------------------------------------------------------------------
 .../geode.apache.org/lucene/lucene-1.0.xsd      | 58 --------------------
 .../schema/lucene/lucene-1.0.xsd                | 58 ++++++++++++++++++++
 ...uceneIndexXmlParserIntegrationJUnitTest.java |  9 +++
 ...nvalidXmlShouldThrowParseException.cache.xml | 39 +++++++++++++
 4 files changed, 106 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/313febd9/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/lucene/lucene-1.0.xsd
----------------------------------------------------------------------
diff --git 
a/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/lucene/lucene-1.0.xsd
 
b/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/lucene/lucene-1.0.xsd
deleted file mode 100644
index ec82c2f..0000000
--- 
a/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/lucene/lucene-1.0.xsd
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<xsd:schema
-    targetNamespace="http://geode.apache.org/schema/lucene";
-    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
-    elementFormDefault="qualified"
-    attributeFormDefault="unqualified"
-    version="1.0">
-  
-  <xsd:import
-      namespace="http://geode.apache.org/schema/cache";
-      schemaLocation="http://geode.apache.org/schema/cache/cache-1.0.xsd"/>
-  
-  <xsd:annotation>
-    <xsd:documentation><![CDATA[
-XML schema for Lucene indexes in Geode.
-
-  <cache
-    xmlns="http://geode.apache.org/schema/cache";
-    xmlns:lucene="http://geode.apache.org/schema/lucene";
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://geode.apache.org/schema/cache
-        http://geode.apache.org/schema/cache/cache-1.0.xsd
-        http://geode.apache.org/schema/lucene
-        http://geode.apache.org/schema/lucene/lucene-1.0.xsd";
-    version="1.0">
-    
-    ]]></xsd:documentation>
-  </xsd:annotation>
-  <xsd:element name="index">
-    <xsd:complexType>
-       <xsd:sequence>
-         <xsd:element name="field" maxOccurs="unbounded">
-                       <xsd:complexType>
-                               <xsd:attribute name="name" type="xsd:string" />
-                               <xsd:attribute name="analyzer" 
type="xsd:string" />
-                       </xsd:complexType>
-         </xsd:element>
-       </xsd:sequence>
-       <xsd:attribute name="name" type="xsd:string"/>
-    </xsd:complexType>
-  </xsd:element>
-</xsd:schema>

http://git-wip-us.apache.org/repos/asf/geode/blob/313febd9/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/schema/lucene/lucene-1.0.xsd
----------------------------------------------------------------------
diff --git 
a/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/schema/lucene/lucene-1.0.xsd
 
b/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/schema/lucene/lucene-1.0.xsd
new file mode 100644
index 0000000..ec82c2f
--- /dev/null
+++ 
b/geode-lucene/src/main/resources/META-INF/schemas/geode.apache.org/schema/lucene/lucene-1.0.xsd
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<xsd:schema
+    targetNamespace="http://geode.apache.org/schema/lucene";
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+    elementFormDefault="qualified"
+    attributeFormDefault="unqualified"
+    version="1.0">
+  
+  <xsd:import
+      namespace="http://geode.apache.org/schema/cache";
+      schemaLocation="http://geode.apache.org/schema/cache/cache-1.0.xsd"/>
+  
+  <xsd:annotation>
+    <xsd:documentation><![CDATA[
+XML schema for Lucene indexes in Geode.
+
+  <cache
+    xmlns="http://geode.apache.org/schema/cache";
+    xmlns:lucene="http://geode.apache.org/schema/lucene";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://geode.apache.org/schema/cache
+        http://geode.apache.org/schema/cache/cache-1.0.xsd
+        http://geode.apache.org/schema/lucene
+        http://geode.apache.org/schema/lucene/lucene-1.0.xsd";
+    version="1.0">
+    
+    ]]></xsd:documentation>
+  </xsd:annotation>
+  <xsd:element name="index">
+    <xsd:complexType>
+       <xsd:sequence>
+         <xsd:element name="field" maxOccurs="unbounded">
+                       <xsd:complexType>
+                               <xsd:attribute name="name" type="xsd:string" />
+                               <xsd:attribute name="analyzer" 
type="xsd:string" />
+                       </xsd:complexType>
+         </xsd:element>
+       </xsd:sequence>
+       <xsd:attribute name="name" type="xsd:string"/>
+    </xsd:complexType>
+  </xsd:element>
+</xsd:schema>

http://git-wip-us.apache.org/repos/asf/geode/blob/313febd9/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.java
----------------------------------------------------------------------
diff --git 
a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.java
 
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.java
index 5fecf2e..a21a7eb 100644
--- 
a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.java
+++ 
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.java
@@ -17,6 +17,7 @@ package org.apache.geode.cache.lucene.internal.xml;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheXmlException;
 import org.apache.geode.cache.lucene.LuceneIndex;
 import org.apache.geode.cache.lucene.LuceneService;
 import org.apache.geode.cache.lucene.LuceneServiceProvider;
@@ -73,6 +74,14 @@ public class LuceneIndexXmlParserIntegrationJUnitTest {
     validateExpectedIndexes(region, expectedIndexes);
   }
 
+  /**
+   * Test that we parse the index fields correctly
+   */
+  @Test(expected = CacheXmlException.class)
+  public void invalidXmlShouldThrowParseException() throws 
FileNotFoundException {
+    RegionCreation region = createRegionCreation("region");
+  }
+
   @Test
   public void parseIndexWithAnalyzers() throws FileNotFoundException {
     RegionCreation region = createRegionCreation("region");

http://git-wip-us.apache.org/repos/asf/geode/blob/313febd9/geode-lucene/src/test/resources/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.invalidXmlShouldThrowParseException.cache.xml
----------------------------------------------------------------------
diff --git 
a/geode-lucene/src/test/resources/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.invalidXmlShouldThrowParseException.cache.xml
 
b/geode-lucene/src/test/resources/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.invalidXmlShouldThrowParseException.cache.xml
new file mode 100644
index 0000000..5d5dca7
--- /dev/null
+++ 
b/geode-lucene/src/test/resources/org/apache/geode/cache/lucene/internal/xml/LuceneIndexXmlParserIntegrationJUnitTest.invalidXmlShouldThrowParseException.cache.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+
+<cache
+    xmlns="http://geode.apache.org/schema/cache";
+    xmlns:lucene="http://geode.apache.org/schema/lucene";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://geode.apache.org/schema/cache
+        http://geode.apache.org/schema/cache/cache-1.0.xsd
+        http://geode.apache.org/schema/lucene
+        http://geode.apache.org/schema/lucene/lucene-1.0.xsd";
+    version="1.0">
+
+       <region name="region" refid="PARTITION">
+       <lucene:index name="index1">
+         <lucene:field name="a"/>
+       </lucene:index>
+
+               <lucene:index namexx="index2">
+                       <lucene:field name="a"/>
+                       <lucene:field name="b"/>
+               </lucene:index>
+    </region>
+</cache>
\ No newline at end of file

Reply via email to