Sergey Shepelevich pushed to branch master at cms-community / hippo-essentials


Commits:
35da7614 by Sergey Shepelevich at 2018-03-14T15:27:56+01:00
ESSENTIALS-604 Remove dead code

- - - - -


2 changed files:

- 
plugin-sdk/implementation/src/main/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtils.java
- − 
plugin-sdk/implementation/src/test/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtilsTest.java


Changes:

=====================================
plugin-sdk/implementation/src/main/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtils.java
=====================================
--- 
a/plugin-sdk/implementation/src/main/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtils.java
+++ 
b/plugin-sdk/implementation/src/main/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtils.java
@@ -42,33 +42,6 @@ public final class HstUtils {
 
     private static final Logger log = LoggerFactory.getLogger(HstUtils.class);
 
-    public static Set<Node> getHstMounts(final JcrService jcrService) {
-        final Session session = jcrService.createSession();
-
-        try {
-            final Workspace workspace = session.getWorkspace();
-            final QueryManager queryManager = workspace.getQueryManager();
-            final Query query = 
queryManager.createQuery("//hst:hst/hst:hosts//element(*, hst:mount)", "xpath");
-            final QueryResult queryResult = query.execute();
-            final NodeIterator nodes = queryResult.getNodes();
-            final Set<Node> retVal = new HashSet<>();
-            while (nodes.hasNext()) {
-                final Node node = nodes.nextNode();
-                retVal.add(node);
-            }
-            return retVal;
-        } catch (InvalidQueryException e) {
-            log.error("Error creating query", e);
-        } catch (RepositoryException e) {
-            log.error("Error fetching hst:host nodes", e);
-        } finally {
-            jcrService.destroySession(session);
-        }
-        return Collections.emptySet();
-
-    }
-
-
     private HstUtils() {
         // utility
     }


=====================================
plugin-sdk/implementation/src/test/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtilsTest.java
 deleted
=====================================
--- 
a/plugin-sdk/implementation/src/test/java/org/onehippo/cms7/essentials/plugin/sdk/utils/HstUtilsTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014-2018 Hippo B.V. (http://www.onehippo.com)
- *
- * Licensed 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.onehippo.cms7.essentials.plugin.sdk.utils;
-
-import java.util.Set;
-
-import javax.jcr.Node;
-import javax.jcr.Session;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onehippo.cms7.essentials.BaseRepositoryTest;
-
-import static org.junit.Assert.assertEquals;
-
-public class HstUtilsTest extends BaseRepositoryTest{
-
-    @Test
-    public void testGetHstMounts() throws Exception {
-        final Set<Node> hstMounts = HstUtils.getHstMounts(jcrService);
-        assertEquals("expected 3 mounts, hst:root and 2 added by us", 3, 
hstMounts.size());
-    }
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        final Session session = jcrService.createSession();
-        final Node root = session.getNode("/hst:hst")
-                .addNode("hst:hosts", "hst:virtualhosts")
-                .addNode("localhost-group", "hst:virtualhostgroup")
-                .addNode("localhost", "hst:virtualhost")
-                .addNode("hst:root", "hst:mount");
-        root.addNode("restone", "hst:mount");
-        root.addNode("resttwo", "hst:mount");
-        session.save();
-        jcrService.destroySession(session);
-    }
-}
\ No newline at end of file



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-essentials/commit/35da761463727b84edb0728317bc8ec5ba64614c

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-essentials/commit/35da761463727b84edb0728317bc8ec5ba64614c
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to