10N/A/*
10N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10N/A *
10N/A * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
10N/A *
10N/A * The contents of this file are subject to the terms of either the GNU
10N/A * General Public License Version 2 only ("GPL") or the Common Development
10N/A * and Distribution License("CDDL") (collectively, the "License"). You
10N/A * may not use this file except in compliance with the License. You can
10N/A * obtain a copy of the License at
10N/A * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
10N/A * or packager/legal/LICENSE.txt. See the License for the specific
10N/A * language governing permissions and limitations under the License.
10N/A *
10N/A * When distributing the software, include this License Header Notice in each
10N/A * file and include the License file at packager/legal/LICENSE.txt.
10N/A *
10N/A * GPL Classpath Exception:
10N/A * Oracle designates this particular file as subject to the "Classpath"
10N/A * exception as provided by Oracle in the GPL Version 2 section of the License
10N/A * file that accompanied this code.
3770N/A *
10N/A * Modifications:
10N/A * If applicable, add the following below the License Header, with the fields
10N/A * enclosed by brackets [] replaced by your own identifying information:
10N/A * "Portions Copyright [year] [name of copyright owner]"
10N/A *
10N/A * Contributor(s):
10N/A * If you wish your version of this file to be governed by only the CDDL or
10N/A * only the GPL Version 2, indicate your decision by adding "[Contributor]
10N/A * elects to include this software in this distribution under the [CDDL or GPL
10N/A * Version 2] license." If you don't indicate a single choice of license, a
10N/A * recipient has the option to distribute your version of this file under
10N/A * either the CDDL, the GPL Version 2 or to extend the choice of license to
10N/A * its licensees as provided above. However, if you add GPL Version 2 code
10N/A * and therefore, elected the GPL Version 2 license, then the option applies
10N/A * only if the new code is made subject to such option by the copyright
10N/A * holder.
10N/A */
10N/A
10N/Apackage test.admin;
10N/A
10N/Aimport java.net.HttpURLConnection;
10N/Aimport java.net.URL;
10N/Aimport org.testng.Assert;
10N/Aimport org.testng.annotations.Test;
10N/A
10N/A/** Supposed to have JDBC connection pool and resource tests.
10N/A *
10N/A * @author केदा&#2352 (km@dev.java.net)
10N/A * @since GlassFish v3 Prelude
10N/A */
10N/A@Test(groups = {"rest"}, description = "REST API Tests")
10N/Apublic class RestTests {
10N/A
10N/A @Test
10N/A public void testManagementEndpoint() {
10N/A try {
10N/A HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:4848/management/domain.xml").openConnection();
10N/A Assert.assertEquals(200, connection.getResponseCode());
10N/A } catch (Exception e) {
10N/A Assert.fail(e.getMessage());
10N/A }
10N/A }
10N/A
10N/A @Test
10N/A public void testMonitoringEndpoint() {
10N/A try {
10N/A HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:4848/monitoring/domain.xml").openConnection();
10N/A Assert.assertEquals(200, connection.getResponseCode());
10N/A } catch (Exception e) {
10N/A Assert.fail(e.getMessage());
10N/A }
10N/A }
10N/A
10N/A @Test
10N/A public void testEndpointWithEncodedSlash() {
10N/A try {
10N/A HttpURLConnection connection = (HttpURLConnection) new URL("http://localhost:4848/management/domain/resources/jdbc-resource/jdbc%2F__TimerPool.xml").openConnection();
10N/A Assert.assertEquals(200, connection.getResponseCode());
10N/A } catch (Exception e) {
10N/A Assert.fail(e.getMessage());
10N/A }
10N/A }
10N/A}
10N/A