You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jc...@apache.org on 2019/01/30 00:41:34 UTC
[geode] branch feature/GEODE-6273 updated: Removed
DataSerialization from DescribeMappingResult
This is an automated email from the ASF dual-hosted git repository.
jchen21 pushed a commit to branch feature/GEODE-6273
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-6273 by this push:
new 413803b Removed DataSerialization from DescribeMappingResult
413803b is described below
commit 413803b12e0f1be06cb577a518e5d891bee07a7c
Author: Jianxia Chen <jc...@pivotal.io>
AuthorDate: Tue Jan 29 16:40:46 2019 -0800
Removed DataSerialization from DescribeMappingResult
Co-authored-by: Jianxia Chen <jc...@pivotal.io>
Co-authored-by: Ben Ross <br...@pivotal.io>
---
.../codeAnalysis/sanctionedDataSerializables.txt | 3 --
.../util/internal/DescribeMappingResult.java | 36 +------------
.../util/internal/DescribeMappingResultTest.java | 61 ----------------------
3 files changed, 2 insertions(+), 98 deletions(-)
diff --git a/geode-connectors/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-connectors/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index 5dd33d0..e69de29 100644
--- a/geode-connectors/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-connectors/src/integrationTest/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -1,3 +0,0 @@
-org/apache/geode/connectors/util/internal/DescribeMappingResult,2
-fromData,48
-toData,80
\ No newline at end of file
diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/util/internal/DescribeMappingResult.java b/geode-connectors/src/main/java/org/apache/geode/connectors/util/internal/DescribeMappingResult.java
index df1552a..6b63904 100644
--- a/geode-connectors/src/main/java/org/apache/geode/connectors/util/internal/DescribeMappingResult.java
+++ b/geode-connectors/src/main/java/org/apache/geode/connectors/util/internal/DescribeMappingResult.java
@@ -14,17 +14,12 @@
*/
package org.apache.geode.connectors.util.internal;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
-import org.apache.geode.DataSerializable;
-import org.apache.geode.DataSerializer;
-
-public class DescribeMappingResult implements DataSerializable {
+public class DescribeMappingResult {
private final Map<String, String> attributeMap;
+ private String groupName;
public DescribeMappingResult() {
this.attributeMap = new LinkedHashMap<>();
@@ -38,8 +33,6 @@ public class DescribeMappingResult implements DataSerializable {
return this.attributeMap;
}
- private String groupName;
-
public String getGroupName() {
return groupName;
}
@@ -47,29 +40,4 @@ public class DescribeMappingResult implements DataSerializable {
public void setGroupName(String group) {
groupName = group;
}
-
- @Override
- public void toData(DataOutput out) throws IOException {
- DataSerializer.writeString(groupName, out);
- DataSerializer.writeInteger(attributeMap.size(), out);
- for (Map.Entry<String, String> entry : attributeMap.entrySet()) {
- DataSerializer.writeString(entry.getKey(), out);
- DataSerializer.writeString(entry.getValue(), out);
- }
- }
-
- @Override
- public void fromData(DataInput in) throws IOException {
- groupName = DataSerializer.readString(in);
- int dataSize = DataSerializer.readInteger(in);
-
- for (int i = 0; i < dataSize; i++) {
- String key, value;
-
- key = DataSerializer.readString(in);
- value = DataSerializer.readString(in);
-
- this.attributeMap.put(key, value);
- }
- }
}
diff --git a/geode-connectors/src/test/java/org/apache/geode/connectors/util/internal/DescribeMappingResultTest.java b/geode-connectors/src/test/java/org/apache/geode/connectors/util/internal/DescribeMappingResultTest.java
deleted file mode 100644
index c2e75d8..0000000
--- a/geode-connectors/src/test/java/org/apache/geode/connectors/util/internal/DescribeMappingResultTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.util.internal;
-
-import static org.apache.geode.connectors.util.internal.MappingConstants.DATA_SOURCE_NAME;
-import static org.apache.geode.connectors.util.internal.MappingConstants.ID_NAME;
-import static org.apache.geode.connectors.util.internal.MappingConstants.PDX_NAME;
-import static org.apache.geode.connectors.util.internal.MappingConstants.REGION_NAME;
-import static org.apache.geode.connectors.util.internal.MappingConstants.SYNCHRONOUS_NAME;
-import static org.apache.geode.connectors.util.internal.MappingConstants.TABLE_NAME;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jgroups.util.ByteArrayDataInputStream;
-import org.jgroups.util.ByteArrayDataOutputStream;
-import org.junit.Test;
-
-public class DescribeMappingResultTest {
-
- @Test
- public void testSeriazilabeToAndFromByteArray() throws IOException {
- Map<String, String> attributesMap = new HashMap<>();
- attributesMap.put(REGION_NAME, "myRegion");
- attributesMap.put(TABLE_NAME, "myTable");
- attributesMap.put(PDX_NAME, "myPdx");
- attributesMap.put(DATA_SOURCE_NAME, "myDatasource");
- attributesMap.put(SYNCHRONOUS_NAME, "false");
- attributesMap.put(ID_NAME, "myId");
-
- DescribeMappingResult result = new DescribeMappingResult(attributesMap);
- DescribeMappingResult newResult = new DescribeMappingResult();
-
- ByteArrayDataOutputStream output = new ByteArrayDataOutputStream();
- ByteArrayDataInputStream input;
-
- result.toData(output);
-
- input = new ByteArrayDataInputStream(output.buffer());
-
- newResult.fromData(input);
-
- Map<String, String> newAttributeMap = newResult.getAttributeMap();
- assertThat(attributesMap).isEqualTo(newAttributeMap);
- }
-
-}