Search in sources :

Example 6 with LinkIndex

use of org.apache.geode.management.internal.web.domain.LinkIndex in project geode by apache.

the class ShellCommandsControllerJUnitTest method testCommandHasRestApiControllerWebServiceEndpoint.

@Test
public void testCommandHasRestApiControllerWebServiceEndpoint() {
    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
    assertNotNull(controllerWebServiceEndpoints);
    assertFalse(controllerWebServiceEndpoints.isEmpty());
    LinkIndex linkIndex = controller.index("http");
    assertNotNull(linkIndex);
    assertFalse(linkIndex.isEmpty());
    List<String> linkWebServiceEndpoints = new ArrayList<>(linkIndex.size());
    for (Link link : linkIndex) {
        linkWebServiceEndpoints.add(link.toHttpRequestLine());
    }
    assertEquals(linkIndex.size(), linkWebServiceEndpoints.size());
    List<String> missingControllerWebServiceEndpoints = new ArrayList<>(linkWebServiceEndpoints);
    missingControllerWebServiceEndpoints.removeAll(controllerWebServiceEndpoints);
    assertTrue(String.format("The Management REST API Web Service Controllers in (%1$s) are missing the following REST API Web Service Endpoint(s): %2$s!", getClass().getPackage().getName(), missingControllerWebServiceEndpoints), missingControllerWebServiceEndpoints.isEmpty());
}
Also used : LinkIndex(org.apache.geode.management.internal.web.domain.LinkIndex) ArrayList(java.util.ArrayList) Link(org.apache.geode.management.internal.web.domain.Link) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 7 with LinkIndex

use of org.apache.geode.management.internal.web.domain.LinkIndex in project geode by apache.

the class ShellCommandsControllerJUnitTest method testIndexUrisHaveCorrectScheme.

@Test
public void testIndexUrisHaveCorrectScheme() {
    String versionCmd = "version";
    List<String> controllerWebServiceEndpoints = getControllerWebServiceEndpoints();
    assertNotNull(controllerWebServiceEndpoints);
    assertFalse(controllerWebServiceEndpoints.isEmpty());
    String testScheme = "xyz";
    LinkIndex linkIndex = controller.index(testScheme);
    assertNotNull(linkIndex);
    assertFalse(linkIndex.isEmpty());
    assertTrue(String.format("Link does not have correct scheme %1$s", linkIndex.find(versionCmd)), testScheme.equals(linkIndex.find(versionCmd).getHref().getScheme()));
}
Also used : LinkIndex(org.apache.geode.management.internal.web.domain.LinkIndex) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Aggregations

LinkIndex (org.apache.geode.management.internal.web.domain.LinkIndex)7 Link (org.apache.geode.management.internal.web.domain.Link)5 Test (org.junit.Test)5 UnitTest (org.apache.geode.test.junit.categories.UnitTest)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 Gfsh (org.apache.geode.management.internal.cli.shell.Gfsh)2 RestHttpOperationInvoker (org.apache.geode.management.internal.web.shell.RestHttpOperationInvoker)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 URI (java.net.URI)1 LinkedHashMap (java.util.LinkedHashMap)1 ObjectName (javax.management.ObjectName)1 QueryExp (javax.management.QueryExp)1 SimpleHttpRequester (org.apache.geode.management.internal.web.http.support.SimpleHttpRequester)1 HttpOperationInvoker (org.apache.geode.management.internal.web.shell.HttpOperationInvoker)1 AuthenticationFailedException (org.apache.geode.security.AuthenticationFailedException)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 Before (org.junit.Before)1