You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by lg...@apache.org on 2017/12/13 19:10:06 UTC
[geode] branch feature/GEODE-3781 updated: Fix unit test failures
due to mcast port
This is an automated email from the ASF dual-hosted git repository.
lgallinat pushed a commit to branch feature/GEODE-3781
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-3781 by this push:
new 44de804 Fix unit test failures due to mcast port
44de804 is described below
commit 44de80499a30bdb939fb32aa7521394a0468d69d
Author: Lynn Gallinat <lg...@pivotal.io>
AuthorDate: Wed Dec 13 11:08:33 2017 -0800
Fix unit test failures due to mcast port
---
...cConnectorServiceXmlGeneratorIntegrationTest.java | 20 +++++++++++---------
.../xml/JdbcConnectorServiceXmlIntegrationTest.java | 12 +++++++++---
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlGeneratorIntegrationTest.java b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlGeneratorIntegrationTest.java
index b620e49..54f5126 100644
--- a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlGeneratorIntegrationTest.java
+++ b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlGeneratorIntegrationTest.java
@@ -31,6 +31,7 @@ import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FIL
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -40,6 +41,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -166,9 +168,7 @@ public class JdbcConnectorServiceXmlGeneratorIntegrationTest {
generateXml();
cache.close();
- cache = (InternalCache) new CacheFactory().set(CACHE_XML_FILE, cacheXmlFile.getAbsolutePath())
- .create();
-
+ createCacheUsingXml();
service = cache.getService(InternalJdbcConnectorService.class);
assertThat(service.getConnectionConfig("name")).isEqualTo(config);
}
@@ -184,9 +184,7 @@ public class JdbcConnectorServiceXmlGeneratorIntegrationTest {
generateXml();
cache.close();
- cache = (InternalCache) new CacheFactory().set(CACHE_XML_FILE, cacheXmlFile.getAbsolutePath())
- .create();
-
+ createCacheUsingXml();
service = cache.getService(InternalJdbcConnectorService.class);
assertThat(service.getMappingForRegion("region")).isEqualTo(mapping);
}
@@ -205,9 +203,7 @@ public class JdbcConnectorServiceXmlGeneratorIntegrationTest {
generateXml();
cache.close();
- cache = (InternalCache) new CacheFactory().set(CACHE_XML_FILE, cacheXmlFile.getAbsolutePath())
- .create();
-
+ createCacheUsingXml();
service = cache.getService(InternalJdbcConnectorService.class);
assertThat(service.getConnectionConfig("name")).isEqualTo(config);
assertThat(service.getMappingForRegion("region")).isEqualTo(mapping);
@@ -255,4 +251,10 @@ public class JdbcConnectorServiceXmlGeneratorIntegrationTest {
CacheXmlGenerator.generate(cache, printWriter, true, false, false);
printWriter.flush();
}
+
+ private void createCacheUsingXml() throws IOException {
+ byte[] bytes = FileUtils.readFileToByteArray(cacheXmlFile);
+ cache = (InternalCache) new CacheFactory().set("locators", "").set("mcast-port", "0").create();
+ cache.loadCacheXml(new ByteArrayInputStream(bytes));
+ }
}
diff --git a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlIntegrationTest.java b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlIntegrationTest.java
index 445ee2a..153043a 100644
--- a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlIntegrationTest.java
+++ b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/internal/xml/JdbcConnectorServiceXmlIntegrationTest.java
@@ -17,11 +17,13 @@ package org.apache.geode.connectors.jdbc.internal.xml;
import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
import static org.assertj.core.api.Assertions.assertThat;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
+import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -70,9 +72,7 @@ public class JdbcConnectorServiceXmlIntegrationTest {
@Test
public void canRecreateJdbcConnectorServiceFromXml() throws Exception {
- cache =
- (InternalCache) new CacheFactory().set(CACHE_XML_FILE, cacheXml.getAbsolutePath()).create();
-
+ createCacheUsingXml();
JdbcConnectorService service =
(JdbcConnectorService) cache.getExtensionPoint().getExtensions().iterator().next();
assertThat(service.getConnectionConfig(config1.getName())).isEqualTo(config1);
@@ -119,4 +119,10 @@ public class JdbcConnectorServiceXmlIntegrationTest {
printWriter.flush();
return cacheXml;
}
+
+ private void createCacheUsingXml() throws IOException {
+ byte[] bytes = FileUtils.readFileToByteArray(cacheXml);
+ cache = (InternalCache) new CacheFactory().set("locators", "").set("mcast-port", "0").create();
+ cache.loadCacheXml(new ByteArrayInputStream(bytes));
+ }
}
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].