You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/11/07 08:34:17 UTC

[GitHub] [geode] masaki-yamakawa commented on a change in pull request #5637: GEODE-8626: Omitting field-mapping tag of cache.xml when using Simple JDBC Connector

masaki-yamakawa commented on a change in pull request #5637:
URL: https://github.com/apache/geode/pull/5637#discussion_r519153030



##########
File path: geode-connectors/src/acceptanceTest/java/org/apache/geode/connectors/jdbc/CacheXmlJdbcMappingIntegrationTest.java
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You 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.apache.geode.connectors.jdbc;
+
+import static org.apache.geode.test.util.ResourceUtils.createTempFileFromResource;
+
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.internal.cache.InternalCache;
+
+public class CacheXmlJdbcMappingIntegrationTest extends JdbcMappingIntegrationTest {
+
+  @Rule
+  public RestoreSystemProperties restoreSystemProperties = new RestoreSystemProperties();
+
+  @Override
+  protected InternalCache createCacheAndCreateJdbcMapping(String cacheXmlTestName)
+      throws Exception {
+    String url = dbRule.getConnectionUrl().replaceAll("&", "&amp;");

Review comment:
       When expanding Java system properties like `<jndi-binding ... connection-url="${TestDataSourceUrl}">` in cache.xml and the connection string contains '?' such as `jdbc:mysql://localhost:3306?user=root&useSSL=false`, if the connection string is not escaped, an error will occur when connecting to the database.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org