forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into geode-6400
- Loading branch information
Showing
85 changed files
with
3,326 additions
and
896 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
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
88 changes: 88 additions & 0 deletions
88
...Test/java/org/apache/geode/management/internal/rest/MemberManagementServiceDunitTest.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,88 @@ | ||
/* | ||
* 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.rest; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
|
||
import org.apache.geode.cache.configuration.CacheElement; | ||
import org.apache.geode.management.api.ClusterManagementResult; | ||
import org.apache.geode.management.api.ClusterManagementService; | ||
import org.apache.geode.management.client.ClusterManagementServiceProvider; | ||
import org.apache.geode.management.configuration.MemberConfig; | ||
import org.apache.geode.test.dunit.rules.ClusterStartupRule; | ||
import org.apache.geode.test.dunit.rules.MemberVM; | ||
|
||
public class MemberManagementServiceDunitTest { | ||
@ClassRule | ||
public static ClusterStartupRule cluster = new ClusterStartupRule(2); | ||
|
||
private static MemberVM locator, server; | ||
private static ClusterManagementService cmsClient; | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
locator = cluster.startLocatorVM(0, l -> l.withHttpService()); | ||
server = cluster.startServerVM(1, locator.getPort()); | ||
cmsClient = ClusterManagementServiceProvider.getService("localhost", locator.getHttpPort()); | ||
} | ||
|
||
@Test | ||
public void listAllMembers() { | ||
MemberConfig config = new MemberConfig(); | ||
ClusterManagementResult result = cmsClient.list(config); | ||
|
||
assertThat(result.isSuccessful()).isTrue(); | ||
assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK); | ||
assertThat(result.getResult().size()).isEqualTo(2); | ||
|
||
MemberConfig memberConfig = | ||
(MemberConfig) CacheElement.findElement(result.getResult(), "locator-0"); | ||
assertThat(memberConfig.isCoordinator()).isTrue(); | ||
assertThat(memberConfig.isLocator()).isTrue(); | ||
assertThat(memberConfig.getPorts().get(0)).isEqualTo(locator.getPort()); | ||
} | ||
|
||
@Test | ||
public void listOneMember() throws Exception { | ||
MemberConfig config = new MemberConfig(); | ||
config.setId("locator-0"); | ||
|
||
ClusterManagementResult result = cmsClient.list(config); | ||
assertThat(result.isSuccessful()).isTrue(); | ||
assertThat(result.getStatusCode()).isEqualTo(ClusterManagementResult.StatusCode.OK); | ||
assertThat(result.getResult().size()).isEqualTo(1); | ||
|
||
MemberConfig memberConfig = (MemberConfig) result.getResult().get(0); | ||
assertThat(memberConfig.isCoordinator()).isTrue(); | ||
assertThat(memberConfig.isLocator()).isTrue(); | ||
assertThat(memberConfig.getPorts().get(0)).isEqualTo(locator.getPort()); | ||
} | ||
|
||
@Test | ||
public void listNonExistentMember() throws Exception { | ||
MemberConfig config = new MemberConfig(); | ||
config.setId("locator"); | ||
ClusterManagementResult result = cmsClient.list(config); | ||
assertThat(result.isSuccessful()).isTrue(); | ||
assertThat(result.getStatusCode()) | ||
.isEqualTo(ClusterManagementResult.StatusCode.OK); | ||
assertThat(result.getResult().size()).isEqualTo(0); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...g/apache/geode/management/internal/rest/controllers/ClusterManagementRestLoggingTest.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,45 @@ | ||
/* | ||
* 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.rest.controllers; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
|
||
import org.apache.geode.management.api.ClusterManagementService; | ||
import org.apache.geode.management.internal.ClientClusterManagementService; | ||
import org.apache.geode.test.junit.rules.LocatorStarterRule; | ||
|
||
public class ClusterManagementRestLoggingTest { | ||
@ClassRule | ||
public static LocatorStarterRule locator = new LocatorStarterRule().withHttpService() | ||
.withSystemProperty("geode.management.request.logging", "false").withAutoStart(); | ||
|
||
private static ClusterManagementService cms; | ||
|
||
@BeforeClass | ||
public static void beforeClass() throws Exception { | ||
cms = new ClientClusterManagementService("localhost", locator.getHttpPort()); | ||
} | ||
|
||
@Test | ||
public void ping() throws Exception { | ||
assertThat(cms.isConnected()).isTrue(); | ||
} | ||
|
||
} |
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
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
37 changes: 37 additions & 0 deletions
37
geode-common/src/main/java/org/apache/geode/util/internal/GeodeJsonMapper.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,37 @@ | ||
/* | ||
* 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.util.internal; | ||
|
||
import com.fasterxml.jackson.core.JsonParser; | ||
import com.fasterxml.jackson.databind.MapperFeature; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
/** | ||
* helper class for creating various json mappers used by Geode Project | ||
*/ | ||
public class GeodeJsonMapper { | ||
|
||
/** | ||
* @return a jackson json mapper that allows single quotes and is able to deserialize json | ||
* string without @JsonTypeInfo if base class is a concrete implementation. | ||
*/ | ||
public static ObjectMapper getMapper() { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); | ||
mapper.configure(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL, true); | ||
return mapper; | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.