Skip to content

Commit

Permalink
Add test to verify product Name is correctly looked up
Browse files Browse the repository at this point in the history
  • Loading branch information
Udo Kohlmeyer committed Feb 1, 2023
1 parent 1e8ddb7 commit d3c1a00
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spring-data-vmware-gemfire/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
api "com.vmware.gemfire:geode-lucene:$gemfireVersion"
api "com.vmware.gemfire:geode-tcp-server:$gemfireVersion"
api "com.vmware.gemfire:geode-deployment-legacy:$gemfireVersion"
api "com.vmware.gemfire:gemfire-version:$gemfireVersion"

implementation 'javax.cache:cache-api:1.1.1'
implementation 'org.springframework:spring-context-support:5.3.25'
Expand Down Expand Up @@ -135,3 +136,5 @@ repositories {
}
}
}

tasks.withType(Copy).all { duplicatesStrategy 'exclude' }
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) VMware, Inc. 2023. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package com.vmware.gemfire.cache;

import org.apache.geode.cache.Cache;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.gemfire.GemfireUtils;
import org.springframework.data.gemfire.config.xml.GemfireConstants;

import java.io.File;

import static org.assertj.core.api.Assertions.assertThat;

public class CacheProductNameIntegrationTest {
protected Cache getCache(String configLocation) {

String baseConfigLocation =
File.separator.concat(getClass().getPackage().getName().replace('.', File.separatorChar));

String resolvedConfigLocation = baseConfigLocation.concat(File.separator).concat(configLocation);

ClassPathXmlApplicationContext applicationContext =
new ClassPathXmlApplicationContext(resolvedConfigLocation);

return applicationContext.getBean(GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME, Cache.class);
}

@Test
public void testCacheCanRetrieveProductName() {
System.setProperty("logback.log.level", "info");
Cache cache = getCache(
"cacheCanResolveProductNameIntegrationTests.xml");
assertThat(GemfireUtils.apacheGeodeProductName()).isEqualTo("VMware GemFire");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) VMware, Inc. 2023. All rights reserved.
~ SPDX-License-Identifier: Apache-2.0
-->

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:gfe="http://www.springframework.org/schema/geode"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/geode https://www.springframework.org/schema/geode/spring-geode.xsd
http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
">

<util:properties id="gemfireProperties">
<prop key="name">CacheProductNameIntegrationTest</prop>
<prop key="log-level">info</prop>
</util:properties>

<gfe:cache properties-ref="gemfireProperties"/>
</beans>

0 comments on commit d3c1a00

Please sign in to comment.