SGF-12
SGF-17
+ add parsing integration test
This commit is contained in:
costin
2010-09-02 22:15:19 +03:00
parent 2df12231a0
commit 9ca37b6682
2 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.springframework.data.gemfire.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.File;
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.RegionFactoryBean;
import org.springframework.data.gemfire.TestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
/**
* @author Costin Leau
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("diskstore-ns.xml")
public class DiskStoreRegionParsingTest {
@Autowired
private ApplicationContext context;
@Test
public void testReplicaDataOptions() throws Exception {
assertTrue(context.containsBean("replicated-data"));
RegionFactoryBean fb = context.getBean("&replicated-data", RegionFactoryBean.class);
assertEquals(DataPolicy.PERSISTENT_REPLICATE, TestUtils.readField("dataPolicy", fb));
assertEquals(Scope.DISTRIBUTED_ACK, TestUtils.readField("scope", fb));
RegionAttributes attrs = TestUtils.readField("attributes", fb);
File[] diskDirs = attrs.getDiskDirs();
assertEquals(1, diskDirs.length);
int[] diskDirSizes = attrs.getDiskDirSizes();
assertEquals(1, diskDirSizes.length);
assertEquals(1, diskDirSizes[0]);
}
@Test
public void testPartitionDataOptions() throws Exception {
assertTrue(context.containsBean("partition-data"));
}
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gfe="http://www.springframework.org/schema/gemfire"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<gfe:cache />
<gfe:replicated-region id="replicated-data" persistent="true">
<!--
<gfe:eviction type="entry-count" threshold="50" action="overflow-to-disk"/>
-->
<gfe:disk-store queue-size="50" auto-compact="true" max-oplog-size="10" synchronous-write="false" time-interval="9999">
<gfe:disk-dir location="./" max-size="1"/>
</gfe:disk-store>
</gfe:replicated-region>
<gfe:partitioned-region id="partition-data" persistent="false">
<gfe:eviction type="memory" threshold="50" action="local-destroy"/>
</gfe:partitioned-region>
</beans>