You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by tu...@apache.org on 2015/11/03 12:26:17 UTC
[55/79] incubator-geode git commit: GEODE-309: Move
AgentUtilJUnitTest to the proper package
GEODE-309: Move AgentUtilJUnitTest to the proper package
Move AgentUtilJUnitTest into com.gemstone.gemfire.management.internal
package. Cleanup test including:
- Remove unused imports
- Uncomment a commented test and use @Ignore with description
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/5f82490a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/5f82490a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/5f82490a
Branch: refs/heads/feature/GEODE-17
Commit: 5f82490a1e80b7830e9deed45643909182dd4bd0
Parents: 8f92f8e
Author: Kirk Lund <kl...@pivotal.io>
Authored: Fri Sep 4 12:29:24 2015 -0700
Committer: tushark <tu...@apache.org>
Committed: Tue Nov 3 16:52:44 2015 +0530
----------------------------------------------------------------------
.../src/test/java/AgentUtilJUnitTest.java | 109 -------------------
.../management/internal/AgentUtilJUnitTest.java | 106 ++++++++++++++++++
2 files changed, 106 insertions(+), 109 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5f82490a/gemfire-assembly/src/test/java/AgentUtilJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-assembly/src/test/java/AgentUtilJUnitTest.java b/gemfire-assembly/src/test/java/AgentUtilJUnitTest.java
deleted file mode 100644
index 0f7563b..0000000
--- a/gemfire-assembly/src/test/java/AgentUtilJUnitTest.java
+++ /dev/null
@@ -1,109 +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.
- */
-
-import com.gemstone.gemfire.management.internal.AgentUtil;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import static org.junit.Assert.*;
-
-@Category(IntegrationTest.class)
-public class AgentUtilJUnitTest {
-
- private AgentUtil agentUtil;
- private String version;
-
- @Before
- public void setUp() {
- version = getGemfireVersion();
- agentUtil = new AgentUtil(version);
- }
-
- @Test
- public void testRESTApiExists() {
- String gemFireWarLocation = agentUtil.getGemFireWebApiWarLocation();
- assertNotNull(gemFireWarLocation, "GemFire REST API WAR File was not found");
- }
-
- /*
- * This test should be activated when pulse gets added to Geode
- */
- // @Test
- // public void testPulseWarExists() {
- // String gemFireWarLocation = agentUtil.getPulseWarLocation();
- // assertNotNull(gemFireWarLocation, "Pulse WAR File was not found");
- // }
-
- private String getGemfireVersion() {
- String version = null;
-
- Properties prop = new Properties();
- InputStream inputStream = null;
- String pathPrefix = null;
- try {
- pathPrefix = calculatePathPrefixToProjectRoot("gemfire-assembly/");
- inputStream = new FileInputStream(pathPrefix + "gradle.properties");
- } catch (FileNotFoundException e1) {
- try {
- pathPrefix = calculatePathPrefixToProjectRoot("gemfire-core/");
- inputStream = new FileInputStream(pathPrefix + "gradle.properties");
- } catch (FileNotFoundException e) {
- }
- }
-
- if (inputStream != null) {
- try {
- prop.load(inputStream);
- version = prop.getProperty("version");
- } catch (FileNotFoundException e) {
- } catch (IOException e) {
- }
- }
- return version;
- }
-
- private String calculatePathPrefixToProjectRoot(String subDirectory) {
- String pathPrefix = "";
-
- String currentDirectoryPath = new File(".").getAbsolutePath();
- int gemfireCoreLocationIx = currentDirectoryPath.indexOf(subDirectory);
- if (gemfireCoreLocationIx < 0) {
- return pathPrefix;
- }
-
- String pathFromRoot = currentDirectoryPath.substring(gemfireCoreLocationIx);
- int segmentsCount = pathFromRoot.split("/").length - 1;
-
- for (int i = 0; i < segmentsCount; i++) {
- pathPrefix = pathPrefix + "../";
- }
- return pathPrefix;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/5f82490a/gemfire-assembly/src/test/java/com/gemstone/gemfire/management/internal/AgentUtilJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-assembly/src/test/java/com/gemstone/gemfire/management/internal/AgentUtilJUnitTest.java b/gemfire-assembly/src/test/java/com/gemstone/gemfire/management/internal/AgentUtilJUnitTest.java
new file mode 100644
index 0000000..cd2c429
--- /dev/null
+++ b/gemfire-assembly/src/test/java/com/gemstone/gemfire/management/internal/AgentUtilJUnitTest.java
@@ -0,0 +1,106 @@
+/*
+ * 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 com.gemstone.gemfire.management.internal;
+
+import com.gemstone.gemfire.management.internal.AgentUtil;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import static org.junit.Assert.*;
+
+@Category(IntegrationTest.class)
+public class AgentUtilJUnitTest {
+
+ private AgentUtil agentUtil;
+ private String version;
+
+ @Before
+ public void setUp() {
+ version = getGemfireVersion();
+ agentUtil = new AgentUtil(version);
+ }
+
+ @Test
+ public void testRESTApiExists() {
+ String gemFireWarLocation = agentUtil.getGemFireWebApiWarLocation();
+ assertNotNull(gemFireWarLocation, "GemFire REST API WAR File was not found");
+ }
+
+ @Ignore("This test should be activated when pulse gets added to Geode")
+ @Test
+ public void testPulseWarExists() {
+ String gemFireWarLocation = agentUtil.getPulseWarLocation();
+ assertNotNull(gemFireWarLocation, "Pulse WAR File was not found");
+ }
+
+ private String getGemfireVersion() {
+ String version = null;
+
+ Properties prop = new Properties();
+ InputStream inputStream = null;
+ String pathPrefix = null;
+ try {
+ pathPrefix = calculatePathPrefixToProjectRoot("gemfire-assembly/");
+ inputStream = new FileInputStream(pathPrefix + "gradle.properties");
+ } catch (FileNotFoundException e1) {
+ try {
+ pathPrefix = calculatePathPrefixToProjectRoot("gemfire-core/");
+ inputStream = new FileInputStream(pathPrefix + "gradle.properties");
+ } catch (FileNotFoundException e) {
+ }
+ }
+
+ if (inputStream != null) {
+ try {
+ prop.load(inputStream);
+ version = prop.getProperty("version");
+ } catch (FileNotFoundException e) {
+ } catch (IOException e) {
+ }
+ }
+ return version;
+ }
+
+ private String calculatePathPrefixToProjectRoot(String subDirectory) {
+ String pathPrefix = "";
+
+ String currentDirectoryPath = new File(".").getAbsolutePath();
+ int gemfireCoreLocationIx = currentDirectoryPath.indexOf(subDirectory);
+ if (gemfireCoreLocationIx < 0) {
+ return pathPrefix;
+ }
+
+ String pathFromRoot = currentDirectoryPath.substring(gemfireCoreLocationIx);
+ int segmentsCount = pathFromRoot.split("/").length - 1;
+
+ for (int i = 0; i < segmentsCount; i++) {
+ pathPrefix = pathPrefix + "../";
+ }
+ return pathPrefix;
+ }
+}