-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test to verify product Name is correctly looked up
- Loading branch information
Udo Kohlmeyer
committed
Feb 1, 2023
1 parent
1e8ddb7
commit d3c1a00
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...mware-gemfire/src/test/java/com/vmware/gemfire/cache/CacheProductNameIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...rc/test/resources/com/vmware/gemfire/cache/cacheCanResolveProductNameIntegrationTests.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |