Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8BAF5200BC3 for ; Fri, 18 Nov 2016 19:56:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8A4BD160B22; Fri, 18 Nov 2016 18:56:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E4A1F160B04 for ; Fri, 18 Nov 2016 19:56:00 +0100 (CET) Received: (qmail 37650 invoked by uid 500); 18 Nov 2016 18:55:58 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 36243 invoked by uid 99); 18 Nov 2016 18:55:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2016 18:55:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E0723E2F35; Fri, 18 Nov 2016 18:55:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: stack@apache.org To: commits@hbase.apache.org Date: Fri, 18 Nov 2016 18:56:12 -0000 Message-Id: In-Reply-To: <71d1e1d206dc41a7b8b041b4ba6d5329@git.apache.org> References: <71d1e1d206dc41a7b8b041b4ba6d5329@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [17/51] [partial] hbase-site git commit: HBASE-17121 Undo the building of xref as part of site build; remove xref dirs archived-at: Fri, 18 Nov 2016 18:56:02 -0000 http://git-wip-us.apache.org/repos/asf/hbase-site/blob/7b604147/xref-test/org/apache/hadoop/hbase/TestJMXConnectorServer.html ---------------------------------------------------------------------- diff --git a/xref-test/org/apache/hadoop/hbase/TestJMXConnectorServer.html b/xref-test/org/apache/hadoop/hbase/TestJMXConnectorServer.html deleted file mode 100644 index 50d5ef2..0000000 --- a/xref-test/org/apache/hadoop/hbase/TestJMXConnectorServer.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - -TestJMXConnectorServer xref - - - -
-
-1   /**
-2    *
-3    * Licensed to the Apache Software Foundation (ASF) under one
-4    * or more contributor license agreements.  See the NOTICE file
-5    * distributed with this work for additional information
-6    * regarding copyright ownership.  The ASF licenses this file
-7    * to you under the Apache License, Version 2.0 (the
-8    * "License"); you may not use this file except in compliance
-9    * with the License.  You may obtain a copy of the License at
-10   *
-11   *     http://www.apache.org/licenses/LICENSE-2.0
-12   *
-13   * Unless required by applicable law or agreed to in writing, software
-14   * distributed under the License is distributed on an "AS IS" BASIS,
-15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-16   * See the License for the specific language governing permissions and
-17   * limitations under the License.
-18   */
-19  package org.apache.hadoop.hbase;
-20
-21  import java.io.IOException;
-22
-23  import javax.management.remote.JMXConnector;
-24  import javax.management.remote.JMXConnectorFactory;
-25  import javax.naming.ServiceUnavailableException;
-26
-27  import org.apache.commons.logging.Log;
-28  import org.apache.commons.logging.LogFactory;
-29  import org.apache.hadoop.conf.Configuration;
-30  import org.apache.hadoop.hbase.client.Admin;
-31  import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
-32  import org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment;
-33  import org.apache.hadoop.hbase.coprocessor.ObserverContext;
-34  import org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment;
-35  import org.apache.hadoop.hbase.security.AccessDeniedException;
-36  import org.apache.hadoop.hbase.security.access.AccessController;
-37  import org.apache.hadoop.hbase.testclassification.MediumTests;
-38  import org.apache.hadoop.hbase.testclassification.MiscTests;
-39  import org.junit.After;
-40  import org.junit.Assert;
-41  import org.junit.Before;
-42  import org.junit.Test;
-43  import org.junit.experimental.categories.Category;
-44
-45  /**
-46   * Test case for JMX Connector Server.
-47   */
-48  @Category({ MiscTests.class, MediumTests.class })
-49  public class TestJMXConnectorServer {
-50    private static final Log LOG = LogFactory.getLog(TestJMXConnectorServer.class);
-51    private static HBaseTestingUtility UTIL = new HBaseTestingUtility();
-52
-53    private static Configuration conf = null;
-54    private static Admin admin;
-55    // RMI registry port
-56    private static int rmiRegistryPort = 61120;
-57    // Switch for customized Accesscontroller to throw ACD exception while executing test case
-58    static boolean hasAccess;
-59
-60    @Before
-61    public void setUp() throws Exception {
-62      UTIL = new HBaseTestingUtility();
-63      conf = UTIL.getConfiguration();
-64    }
-65
-66    @After
-67    public void tearDown() throws Exception {
-68      // Set to true while stopping cluster
-69      hasAccess = true;
-70      admin.close();
-71      UTIL.shutdownMiniCluster();
-72    }
-73
-74    /**
-75     * This tests to validate the HMaster's ConnectorServer after unauthorised stopMaster call.
-76     */
-77    @Test(timeout = 180000)
-78    public void testHMConnectorServerWhenStopMaster() throws Exception {
-79      conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
-80        JMXListener.class.getName() + "," + MyAccessController.class.getName());
-81      conf.setInt("master.rmi.registry.port", rmiRegistryPort);
-82      UTIL.startMiniCluster();
-83      admin = UTIL.getConnection().getAdmin();
-84
-85      // try to stop master
-86      boolean accessDenied = false;
-87      try {
-88        hasAccess = false;
-89        LOG.info("Stopping HMaster...");
-90        admin.stopMaster();
-91      } catch (AccessDeniedException e) {
-92        LOG.info("Exception occured while stopping HMaster. ", e);
-93        accessDenied = true;
-94      }
-95      Assert.assertTrue(accessDenied);
-96
-97      // Check whether HMaster JMX Connector server can be connected
-98      JMXConnector connector = null;
-99      try {
-100       connector = JMXConnectorFactory
-101           .connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
-102     } catch (IOException e) {
-103       if (e.getCause() instanceof ServiceUnavailableException) {
-104         Assert.fail("Can't connect to HMaster ConnectorServer.");
-105       }
-106     }
-107     Assert.assertNotNull("JMXConnector should not be null.", connector);
-108     connector.close();
-109   }
-110
-111   /**
-112    * This tests to validate the RegionServer's ConnectorServer after unauthorised stopRegionServer
-113    * call.
-114    */
-115   @Test(timeout = 180000)
-116   public void testRSConnectorServerWhenStopRegionServer() throws Exception {
-117     conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
-118       JMXListener.class.getName() + "," + MyAccessController.class.getName());
-119     conf.setInt("regionserver.rmi.registry.port", rmiRegistryPort);
-120     UTIL.startMiniCluster();
-121     admin = UTIL.getConnection().getAdmin();
-122
-123     hasAccess = false;
-124     ServerName serverName = UTIL.getHBaseCluster().getRegionServer(0).getServerName();
-125     LOG.info("Stopping Region Server...");
-126     admin.stopRegionServer(serverName.getHostname() + ":" + serverName.getPort());
-127
-128     // Check whether Region Sever JMX Connector server can be connected
-129     JMXConnector connector = null;
-130     try {
-131       connector = JMXConnectorFactory
-132           .connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
-133     } catch (IOException e) {
-134       if (e.getCause() instanceof ServiceUnavailableException) {
-135         Assert.fail("Can't connect to Region Server ConnectorServer.");
-136       }
-137     }
-138     Assert.assertNotNull("JMXConnector should not be null.", connector);
-139     connector.close();
-140   }
-141
-142   /**
-143    * This tests to validate the HMaster's ConnectorServer after unauthorised shutdown call.
-144    */
-145   @Test(timeout = 180000)
-146   public void testHMConnectorServerWhenShutdownCluster() throws Exception {
-147     conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY,
-148       JMXListener.class.getName() + "," + MyAccessController.class.getName());
-149     conf.setInt("master.rmi.registry.port", rmiRegistryPort);
-150
-151     UTIL.startMiniCluster();
-152     admin = UTIL.getConnection().getAdmin();
-153
-154     boolean accessDenied = false;
-155     try {
-156       hasAccess = false;
-157       LOG.info("Stopping HMaster...");
-158       admin.shutdown();
-159     } catch (AccessDeniedException e) {
-160       LOG.error("Exception occured while stopping HMaster. ", e);
-161       accessDenied = true;
-162     }
-163     Assert.assertTrue(accessDenied);
-164
-165     // Check whether HMaster JMX Connector server can be connected
-166     JMXConnector connector = null;
-167     try {
-168       connector = JMXConnectorFactory
-169           .connect(JMXListener.buildJMXServiceURL(rmiRegistryPort, rmiRegistryPort));
-170     } catch (IOException e) {
-171       if (e.getCause() instanceof ServiceUnavailableException) {
-172         Assert.fail("Can't connect to HMaster ConnectorServer.");
-173       }
-174     }
-175     Assert.assertNotNull("JMXConnector should not be null.", connector);
-176     connector.close();
-177   }
-178
-179   /*
-180    * Customized class for test case execution which will throw ACD exception while executing
-181    * stopMaster/preStopRegionServer/preShutdown explicitly.
-182    */
-183   public static class MyAccessController extends AccessController {
-184     @Override
-185     public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
-186       if (!hasAccess) {
-187         throw new AccessDeniedException("Insufficient permissions to stop master");
-188       }
-189     }
-190
-191     @Override
-192     public void preStopRegionServer(ObserverContext<RegionServerCoprocessorEnvironment> ctx)
-193         throws IOException {
-194       if (!hasAccess) {
-195         throw new AccessDeniedException("Insufficient permissions to stop region server.");
-196       }
-197     }
-198
-199     @Override
-200     public void preShutdown(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException {
-201       if (!hasAccess) {
-202         throw new AccessDeniedException("Insufficient permissions to shut down cluster.");
-203       }
-204     }
-205   }
-206 }
-
-
- http://git-wip-us.apache.org/repos/asf/hbase-site/blob/7b604147/xref-test/org/apache/hadoop/hbase/TestJMXListener.html ---------------------------------------------------------------------- diff --git a/xref-test/org/apache/hadoop/hbase/TestJMXListener.html b/xref-test/org/apache/hadoop/hbase/TestJMXListener.html deleted file mode 100644 index 7c34b10..0000000 --- a/xref-test/org/apache/hadoop/hbase/TestJMXListener.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - -TestJMXListener xref - - - -
-
-1   /**
-2    *
-3    * Licensed to the Apache Software Foundation (ASF) under one
-4    * or more contributor license agreements.  See the NOTICE file
-5    * distributed with this work for additional information
-6    * regarding copyright ownership.  The ASF licenses this file
-7    * to you under the Apache License, Version 2.0 (the
-8    * "License"); you may not use this file except in compliance
-9    * with the License.  You may obtain a copy of the License at
-10   *
-11   *     http://www.apache.org/licenses/LICENSE-2.0
-12   *
-13   * Unless required by applicable law or agreed to in writing, software
-14   * distributed under the License is distributed on an "AS IS" BASIS,
-15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-16   * See the License for the specific language governing permissions and
-17   * limitations under the License.
-18   */
-19  package org.apache.hadoop.hbase;
-20  
-21  import java.io.IOException;
-22  
-23  import javax.management.MBeanServerConnection;
-24  import javax.management.remote.JMXConnector;
-25  import javax.management.remote.JMXConnectorFactory;
-26  
-27  import org.apache.commons.logging.Log;
-28  import org.apache.commons.logging.LogFactory;
-29  import org.apache.hadoop.conf.Configuration;
-30  import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
-31  import org.apache.hadoop.hbase.testclassification.MediumTests;
-32  import org.apache.hadoop.hbase.testclassification.MiscTests;
-33  import org.junit.AfterClass;
-34  import org.junit.Assert;
-35  import org.junit.BeforeClass;
-36  import org.junit.Rule;
-37  import org.junit.Test;
-38  import org.junit.experimental.categories.Category;
-39  import org.junit.rules.ExpectedException;
-40  
-41  
-42  
-43  @Category({MiscTests.class, MediumTests.class})
-44  public class TestJMXListener {
-45    private static final Log LOG = LogFactory.getLog(TestJMXListener.class);
-46    private static HBaseTestingUtility UTIL = new HBaseTestingUtility();
-47    private static int connectorPort = 61120;
-48  
-49    @BeforeClass
-50    public static void setupBeforeClass() throws Exception {
-51      Configuration conf = UTIL.getConfiguration();
-52  
-53      conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY,
-54        JMXListener.class.getName());
-55      conf.setInt("regionserver.rmi.registry.port", connectorPort);
-56  
-57      UTIL.startMiniCluster();
-58    }
-59  
-60    @AfterClass
-61    public static void tearDownAfterClass() throws Exception {
-62      UTIL.shutdownMiniCluster();
-63    }
-64  
-65    @Test
-66    public void testStart() throws Exception {
-67      JMXConnector connector = JMXConnectorFactory.connect(
-68        JMXListener.buildJMXServiceURL(connectorPort,connectorPort));
-69  
-70      MBeanServerConnection mb = connector.getMBeanServerConnection();
-71      String domain = mb.getDefaultDomain();
-72      Assert.assertTrue("default domain is not correct",
-73        !domain.isEmpty());
-74      connector.close();
-75  
-76    }
-77  
-78    //shutdown hbase only. then try connect, IOException expected
-79    @Rule
-80    public ExpectedException expectedEx = ExpectedException.none();
-81    @Test
-82    public void testStop() throws Exception {
-83      MiniHBaseCluster cluster = UTIL.getHBaseCluster();
-84      LOG.info("shutdown hbase cluster...");
-85      cluster.shutdown();
-86      LOG.info("wait for the hbase cluster shutdown...");
-87      cluster.waitUntilShutDown();
-88  
-89      JMXConnector connector = JMXConnectorFactory.newJMXConnector(
-90        JMXListener.buildJMXServiceURL(connectorPort,connectorPort), null);
-91      expectedEx.expect(IOException.class);
-92      connector.connect();
-93  
-94    }
-95  
-96  
-97  }
-
-
- -