This is an automated email from the ASF dual-hosted git repository.

jinmeiliao pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4c8a99b  GEODE-7409: get latest PDX configuration of cluster in REST 
API for M… (#4320)
4c8a99b is described below

commit 4c8a99b2444bd16dea37806e3706fa70e0d9ac12
Author: Jinmei Liao <[email protected]>
AuthorDate: Wed Nov 13 20:14:46 2019 -0800

    GEODE-7409: get latest PDX configuration of cluster in REST API for M… 
(#4320)
    
    * GEODE-7409: get latest PDX configuration of cluster in REST API for 
Management
    
    Co-authored-by: Joris Melchior <[email protected]>
---
 .../integrationTest/resources/assembly_content.txt |  1 +
 .../api/LocatorClusterManagementService.java       |  1 -
 .../cli/functions/CacheRealizationFunction.java    |  5 +-
 .../realizers/ConfigurationRealizer.java           |  4 ++
 .../configuration/realizers/PdxRealizer.java       | 38 ++++++++++++
 .../realizers/ReadOnlyConfigurationRealizer.java   | 42 +++++++++++++
 .../sanctioned-geode-management-serializables.txt  |  1 +
 .../configuration/realizers/PdxRealizerTest.java   | 69 ++++++++++++++++++++++
 .../apache/geode/management/configuration/Pdx.java |  4 +-
 .../apache/geode/management/runtime/PdxInfo.java   | 58 ++++++++++++++++++
 .../management/client/ConfigurePDXDUnitTest.java   | 21 ++++++-
 ...usterManagementSecurityRestIntegrationTest.java |  1 +
 .../rest/controllers/PdxManagementController.java  | 10 ++++
 13 files changed, 250 insertions(+), 5 deletions(-)

diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt 
b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index 5c5efd1..1f7702b 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -769,6 +769,7 @@ 
javadoc/org/apache/geode/management/runtime/CacheServerInfo.html
 javadoc/org/apache/geode/management/runtime/GatewayReceiverInfo.html
 javadoc/org/apache/geode/management/runtime/MemberInformation.html
 javadoc/org/apache/geode/management/runtime/OperationResult.html
+javadoc/org/apache/geode/management/runtime/PdxInfo.html
 javadoc/org/apache/geode/management/runtime/RebalanceRegionResult.html
 javadoc/org/apache/geode/management/runtime/RebalanceResult.html
 javadoc/org/apache/geode/management/runtime/RuntimeInfo.html
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
index dc9b738..374f08f 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java
@@ -326,7 +326,6 @@ public class LocatorClusterManagementService implements 
ClusterManagementService
       ConfigurationResult<T, R> response = new ConfigurationResult<>(element);
 
       responses.add(response);
-      // do not gather runtime if this type of CacheElement is 
RespondWith<RuntimeInfo>
       if (!hasRuntimeInfo) {
         continue;
       }
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
index 09c6f56..f33bd8f 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CacheRealizationFunction.java
@@ -32,11 +32,13 @@ import org.apache.geode.management.api.RealizationResult;
 import org.apache.geode.management.configuration.AbstractConfiguration;
 import org.apache.geode.management.configuration.GatewayReceiver;
 import org.apache.geode.management.configuration.Member;
+import org.apache.geode.management.configuration.Pdx;
 import org.apache.geode.management.configuration.Region;
 import org.apache.geode.management.internal.CacheElementOperation;
 import 
org.apache.geode.management.internal.configuration.realizers.ConfigurationRealizer;
 import 
org.apache.geode.management.internal.configuration.realizers.GatewayReceiverRealizer;
 import 
org.apache.geode.management.internal.configuration.realizers.MemberRealizer;
+import 
org.apache.geode.management.internal.configuration.realizers.PdxRealizer;
 import 
org.apache.geode.management.internal.configuration.realizers.RegionConfigRealizer;
 import org.apache.geode.management.runtime.RuntimeInfo;
 
@@ -49,6 +51,7 @@ public class CacheRealizationFunction implements 
InternalFunction<List> {
     realizers.put(Region.class, new RegionConfigRealizer());
     realizers.put(GatewayReceiver.class, new GatewayReceiverRealizer());
     realizers.put(Member.class, new MemberRealizer());
+    realizers.put(Pdx.class, new PdxRealizer());
   }
 
   @Override
@@ -104,7 +107,7 @@ public class CacheRealizationFunction implements 
InternalFunction<List> {
     RealizationResult result = new RealizationResult();
     result.setMemberName(context.getMemberName());
 
-    if (realizer == null) {
+    if (realizer == null || realizer.isReadyOnly()) {
       return result.setMessage("Server '" + context.getMemberName()
           + "' needs to be restarted for this configuration change to be 
realized.");
     }
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
index b4e6148..648d8c8 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ConfigurationRealizer.java
@@ -40,4 +40,8 @@ public interface ConfigurationRealizer<T extends 
AbstractConfiguration<R>, R ext
   RealizationResult update(T config, InternalCache cache);
 
   RealizationResult delete(T config, InternalCache cache);
+
+  default boolean isReadyOnly() {
+    return false;
+  }
 }
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizer.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizer.java
new file mode 100644
index 0000000..e27d811
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizer.java
@@ -0,0 +1,38 @@
+/*
+ * 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.management.internal.configuration.realizers;
+
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.configuration.Pdx;
+import org.apache.geode.management.runtime.PdxInfo;
+import org.apache.geode.pdx.PdxSerializer;
+
+public class PdxRealizer extends ReadOnlyConfigurationRealizer<Pdx, PdxInfo> {
+  @Override
+  public PdxInfo get(Pdx config, InternalCache cache) {
+    PdxInfo info = new PdxInfo();
+    info.setReadSerialized(cache.getPdxReadSerialized());
+    if (cache.getPdxPersistent()) {
+      info.setDiskStoreName(cache.getPdxDiskStore());
+    }
+    info.setIgnoreUnreadFields(cache.getPdxIgnoreUnreadFields());
+    PdxSerializer pdxSerializer = cache.getPdxSerializer();
+    if (pdxSerializer != null) {
+      info.setPdxSerializer(pdxSerializer.getClass().getName());
+    }
+    return info;
+  }
+}
diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ReadOnlyConfigurationRealizer.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ReadOnlyConfigurationRealizer.java
new file mode 100644
index 0000000..5099750
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/configuration/realizers/ReadOnlyConfigurationRealizer.java
@@ -0,0 +1,42 @@
+/*
+ * 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.management.internal.configuration.realizers;
+
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.api.RealizationResult;
+import org.apache.geode.management.configuration.AbstractConfiguration;
+import org.apache.geode.management.runtime.RuntimeInfo;
+
+public abstract class ReadOnlyConfigurationRealizer<T extends 
AbstractConfiguration<R>, R extends RuntimeInfo>
+    implements ConfigurationRealizer<T, R> {
+  public final RealizationResult create(T config, InternalCache cache) {
+    throw new IllegalStateException("should not be invoked");
+  }
+
+  public final RealizationResult update(T config, InternalCache cache) {
+    throw new IllegalStateException("should not be invoked");
+  }
+
+  public final RealizationResult delete(T config, InternalCache cache) {
+    throw new IllegalStateException("should not be invoked");
+  }
+
+  public abstract R get(T config, InternalCache cache);
+
+  public final boolean isReadyOnly() {
+    return true;
+  }
+}
diff --git 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
index 93f0dc2..2c2b377 100644
--- 
a/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
+++ 
b/geode-core/src/main/resources/org/apache/geode/internal/sanctioned-geode-management-serializables.txt
@@ -16,5 +16,6 @@ org/apache/geode/management/configuration/RegionType,false
 
org/apache/geode/management/runtime/CacheServerInfo,true,1,bindAddress:java/lang/String,isRunning:boolean,maxConnections:int,maxThreads:int,port:int
 
org/apache/geode/management/runtime/GatewayReceiverInfo,false,bindAddress:java/lang/String,connectedSenders:java/lang/String[],hostnameForSenders:java/lang/String,port:int,running:boolean,senderCount:int
 
org/apache/geode/management/runtime/MemberInformation,true,1,cacheServerList:java/util/List,cacheXmlFilePath:java/lang/String,clientCount:int,cpuUsage:double,groups:java/lang/String,heapUsage:long,host:java/lang/String,hostedRegions:java/util/Set,httpServiceBindAddress:java/lang/String,httpServicePort:int,id:java/lang/String,initHeapSize:long,isCoordinator:boolean,isSecured:boolean,isServer:boolean,locatorPort:int,locators:java/lang/String,logFilePath:java/lang/String,maxHeapSize:long,of
 [...]
+ 
org/apache/geode/management/runtime/PdxInfo,false,diskStoreName:java/lang/String,ignoreUnreadFields:boolean,pdxSerializer:java/lang/String,readSerialized:boolean
 
org/apache/geode/management/runtime/RuntimeInfo,false,memberName:java/lang/String
 org/apache/geode/management/runtime/RuntimeRegionInfo,false,entryCount:long
diff --git 
a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizerTest.java
 
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizerTest.java
new file mode 100644
index 0000000..b8aeef5
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/realizers/PdxRealizerTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.management.internal.configuration.realizers;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.runtime.PdxInfo;
+
+public class PdxRealizerTest {
+  private PdxRealizer pdxRealizer;
+  private InternalCache cache;
+
+  @Before
+  public void before() throws Exception {
+    pdxRealizer = new PdxRealizer();
+    cache = mock(InternalCache.class);
+  }
+
+  @Test
+  public void getPdxInformation() {
+    when(cache.getPdxReadSerialized()).thenReturn(true);
+    PdxInfo pdxInfo = pdxRealizer.get(null, cache);
+    assertThat(pdxInfo.isReadSerialized()).isTrue();
+    assertThat(pdxInfo.isIgnoreUnreadFields()).isFalse();
+  }
+
+  @Test
+  public void persistent() throws Exception {
+    when(cache.getPdxPersistent()).thenReturn(false);
+    when(cache.getPdxDiskStore()).thenReturn("test");
+    PdxInfo pdxInfo = pdxRealizer.get(null, cache);
+    assertThat(pdxInfo.getDiskStoreName()).isNull();
+
+    when(cache.getPdxPersistent()).thenReturn(true);
+    pdxInfo = pdxRealizer.get(null, cache);
+    assertThat(pdxInfo.getDiskStoreName()).isEqualTo("test");
+  }
+
+  @Test
+  public void readOnly() {
+    assertThat(pdxRealizer.isReadyOnly()).isTrue();
+    assertThatThrownBy(() -> pdxRealizer.create(null, cache))
+        .isInstanceOf(IllegalStateException.class);
+    assertThatThrownBy(() -> pdxRealizer.delete(null, cache))
+        .isInstanceOf(IllegalStateException.class);
+    assertThatThrownBy(() -> pdxRealizer.update(null, cache))
+        .isInstanceOf(IllegalStateException.class);
+  }
+}
diff --git 
a/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
 
b/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
index c679c54..e1dc2ed 100644
--- 
a/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
+++ 
b/geode-management/src/main/java/org/apache/geode/management/configuration/Pdx.java
@@ -20,13 +20,13 @@ package org.apache.geode.management.configuration;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 
 import org.apache.geode.annotations.Experimental;
-import org.apache.geode.management.runtime.RuntimeInfo;
+import org.apache.geode.management.runtime.PdxInfo;
 
 /**
  * Used to configure PDX serialization for a cache.
  */
 @Experimental
-public class Pdx extends AbstractConfiguration<RuntimeInfo> {
+public class Pdx extends AbstractConfiguration<PdxInfo> {
   public static final String PDX_ID = "PDX";
   public static final String PDX_ENDPOINT = "/configurations/pdx";
 
diff --git 
a/geode-management/src/main/java/org/apache/geode/management/runtime/PdxInfo.java
 
b/geode-management/src/main/java/org/apache/geode/management/runtime/PdxInfo.java
new file mode 100644
index 0000000..9c16053
--- /dev/null
+++ 
b/geode-management/src/main/java/org/apache/geode/management/runtime/PdxInfo.java
@@ -0,0 +1,58 @@
+/*
+ * 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.management.runtime;
+
+import org.apache.geode.annotations.Experimental;
+
+@Experimental
+public class PdxInfo extends RuntimeInfo {
+  private boolean readSerialized;
+  private String diskStoreName;
+  private boolean ignoreUnreadFields;
+  private String pdxSerializer;
+
+  public boolean isReadSerialized() {
+    return readSerialized;
+  }
+
+  public void setReadSerialized(boolean readSerialized) {
+    this.readSerialized = readSerialized;
+  }
+
+  public String getDiskStoreName() {
+    return diskStoreName;
+  }
+
+  public void setDiskStoreName(String diskStoreName) {
+    this.diskStoreName = diskStoreName;
+  }
+
+  public boolean isIgnoreUnreadFields() {
+    return ignoreUnreadFields;
+  }
+
+  public void setIgnoreUnreadFields(boolean ignoreUnreadFields) {
+    this.ignoreUnreadFields = ignoreUnreadFields;
+  }
+
+  public String getPdxSerializer() {
+    return pdxSerializer;
+  }
+
+  public void setPdxSerializer(String pdxSerializer) {
+    this.pdxSerializer = pdxSerializer;
+  }
+}
diff --git 
a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ConfigurePDXDUnitTest.java
 
b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ConfigurePDXDUnitTest.java
index 0d782f5..63604c9 100644
--- 
a/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ConfigurePDXDUnitTest.java
+++ 
b/geode-web-management/src/distributedTest/java/org/apache/geode/management/client/ConfigurePDXDUnitTest.java
@@ -19,6 +19,8 @@ package org.apache.geode.management.client;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.util.List;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -36,6 +38,7 @@ import org.apache.geode.cache.configuration.PdxType;
 import 
org.apache.geode.distributed.internal.InternalConfigurationPersistenceService;
 import org.apache.geode.distributed.internal.InternalLocator;
 import org.apache.geode.management.api.ClusterManagementException;
+import org.apache.geode.management.api.ClusterManagementGetResult;
 import org.apache.geode.management.api.ClusterManagementRealizationResult;
 import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.api.ClusterManagementService;
@@ -43,6 +46,7 @@ import org.apache.geode.management.api.RealizationResult;
 import org.apache.geode.management.configuration.Pdx;
 import org.apache.geode.management.internal.rest.LocatorWebContext;
 import org.apache.geode.management.internal.rest.PlainLocatorContextLoader;
+import org.apache.geode.management.runtime.PdxInfo;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 
@@ -89,6 +93,7 @@ public class ConfigurePDXDUnitTest {
 
   @Test
   public void configureWithNoServer() throws Exception {
+    pdxType.setReadSerialized(true);
     ClusterManagementRealizationResult result = client.create(pdxType);
     assertThat(result.isSuccessful()).isTrue();
     
assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);
@@ -99,12 +104,18 @@ public class ConfigurePDXDUnitTest {
     assertThatThrownBy(() -> client.create(pdxType))
         .isInstanceOf(ClusterManagementException.class)
         .hasMessageContaining("ENTITY_EXISTS: Pdx 'PDX' already exists in 
group cluster");
+
+    // verify the get
+    ClusterManagementGetResult<Pdx, PdxInfo> getResult = client.get(new Pdx());
+    Pdx configResult = getResult.getConfigResult();
+    assertThat(configResult.isReadSerialized()).isTrue();
+    assertThat(getResult.getRuntimeResult()).hasSize(0);
   }
 
   @Test
   public void configureWithARunningServer() {
     MemberVM server = cluster.startServerVM(1, 
webContext.getLocator().getPort());
-
+    pdxType.setReadSerialized(true);
     ClusterManagementRealizationResult result = client.create(pdxType);
     assertThat(result.isSuccessful()).isTrue();
     
assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK);
@@ -125,6 +136,14 @@ public class ConfigurePDXDUnitTest {
         .isInstanceOf(ClusterManagementException.class)
         .hasMessageContaining("ENTITY_EXISTS: Pdx 'PDX' already exists in 
group cluster");
 
+    // verify the get
+    ClusterManagementGetResult<Pdx, PdxInfo> getResult = client.get(new Pdx());
+    Pdx configResult = getResult.getConfigResult();
+    assertThat(configResult.isReadSerialized()).isTrue();
+    List<PdxInfo> runtimeResults = getResult.getRuntimeResult();
+    assertThat(runtimeResults).hasSize(1);
+    assertThat(runtimeResults.get(0).isReadSerialized()).isFalse();
+
     server.stop();
   }
 }
diff --git 
a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/ClusterManagementSecurityRestIntegrationTest.java
 
b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/ClusterManagementSecurityRestIntegrationTest.java
index 18ae6d8..cd8f7c0 100644
--- 
a/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/ClusterManagementSecurityRestIntegrationTest.java
+++ 
b/geode-web-management/src/integrationTest/java/org/apache/geode/management/internal/rest/ClusterManagementSecurityRestIntegrationTest.java
@@ -101,6 +101,7 @@ public class ClusterManagementSecurityRestIntegrationTest {
 
     testContexts.add(new TestContext(post("/v1/configurations/pdx"), 
"CLUSTER:MANAGE")
         .setContent(mapper.writeValueAsString(new PdxType())));
+    testContexts.add(new TestContext(get("/v1/configurations/pdx"), 
"CLUSTER:READ"));
 
     testContexts.add(new TestContext(post("/v1/operations/rebalances"), 
"DATA:MANAGE")
         .setContent(mapper.writeValueAsString(new RebalanceOperation())));
diff --git 
a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/PdxManagementController.java
 
b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/PdxManagementController.java
index 16fed6e..a3d5ee0 100644
--- 
a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/PdxManagementController.java
+++ 
b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/controllers/PdxManagementController.java
@@ -24,13 +24,16 @@ import io.swagger.annotations.ApiResponses;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import org.apache.geode.management.api.ClusterManagementGetResult;
 import org.apache.geode.management.api.ClusterManagementResult;
 import org.apache.geode.management.configuration.Pdx;
+import org.apache.geode.management.runtime.PdxInfo;
 
 @RestController("pdxManagement")
 @RequestMapping(URI_VERSION)
@@ -48,4 +51,11 @@ public class PdxManagementController extends 
AbstractManagementController {
     ClusterManagementResult result = clusterManagementService.create(pdxType);
     return new ResponseEntity<>(result, HttpStatus.CREATED);
   }
+
+  @ApiOperation(value = "get pdx")
+  @PreAuthorize("@securityService.authorize('CLUSTER', 'READ')")
+  @GetMapping(PDX_ENDPOINT)
+  public ClusterManagementGetResult<Pdx, PdxInfo> getPDX() {
+    return clusterManagementService.get(new Pdx());
+  }
 }

Reply via email to