diff --git a/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java b/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
index ad823b3a..ecd60028 100644
--- a/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
+++ b/src/test/java/org/springframework/data/gemfire/config/IndexNamespaceTest.java
@@ -16,14 +16,20 @@
package org.springframework.data.gemfire.config;
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
-import org.springframework.data.gemfire.IndexFactoryBean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.query.Index;
+import com.gemstone.gemfire.cache.query.IndexType;
+
/**
*
* @author Costin Leau
@@ -32,19 +38,38 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ContextConfiguration("index-ns.xml")
public class IndexNamespaceTest {
+ private String name = "test-index";
@Autowired
private ApplicationContext context;
+
+ @Before
+ public void setUp() throws Exception {
+ Cache cache = (Cache) context.getBean("gemfire-cache");
+ if (cache.getRegion(name) == null) {
+ cache.createRegionFactory().create("test-index");
+ }
+ }
+
@Test
public void testBasicIndex() throws Exception {
- IndexFactoryBean ifb = null;
+ Index idx = (Index) context.getBean("simple");
- ifb = (IndexFactoryBean) context.getBean("&simple");
- System.out.println("Ifb is " + ifb);
+ assertEquals("/test-index", idx.getFromClause());
+ assertEquals("status", idx.getIndexedExpression());
+ assertEquals("simple", idx.getName());
+ assertEquals(name, idx.getRegion().getName());
+ assertEquals(IndexType.FUNCTIONAL, idx.getType());
}
@Test
public void testComplexIndex() throws Exception {
- }
+ Index idx = (Index) context.getBean("complex");
+ assertEquals("/test-index tsi", idx.getFromClause());
+ assertEquals("tsi.name", idx.getIndexedExpression());
+ assertEquals("complex-index", idx.getName());
+ assertEquals(name, idx.getRegion().getName());
+ assertEquals(IndexType.PRIMARY_KEY, idx.getType());
+ }
}
diff --git a/src/test/resources/org/springframework/data/gemfire/config/index-ns.xml b/src/test/resources/org/springframework/data/gemfire/config/index-ns.xml
index ed92e517..f97b3c5c 100644
--- a/src/test/resources/org/springframework/data/gemfire/config/index-ns.xml
+++ b/src/test/resources/org/springframework/data/gemfire/config/index-ns.xml
@@ -15,7 +15,9 @@
-
+
+
+