[ 
https://issues.apache.org/jira/browse/KNOX-1410?focusedWorklogId=352881&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-352881
 ]

ASF GitHub Bot logged work on KNOX-1410:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Dec/19 18:53
            Start Date: 03/Dec/19 18:53
    Worklog Time Spent: 10m 
      Work Description: pzampino commented on pull request #210: KNOX-1410 - 
Knox Shell support for remote Alias management
URL: https://github.com/apache/knox/pull/210#discussion_r353360340
 
 

 ##########
 File path: 
gateway-shell/src/test/java/org/apache/knox/gateway/shell/alias/AliasTest.java
 ##########
 @@ -0,0 +1,261 @@
+/*
+ * 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 org.apache.knox.gateway.shell.alias;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpRequest;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.util.EntityUtils;
+import org.apache.knox.gateway.shell.KnoxSession;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.concurrent.Callable;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+public class AliasTest {
+
+  @Test
+  public void testAddGatewayAlias() {
+    KnoxSession session = null;
+    try {
+      session = createMockKnoxSession();
+    } catch (Exception e) {
+      fail(e.getMessage());
+    }
+
+    final String alias = "aliasPut1";
+    final String pwd   = "aliasPut1_pwd";
+
+    final String expectedEndpointPath =
+        session.base() + AbstractAliasRequest.SERVICE_PATH + "/" + 
AbstractAliasRequest.GATEWAY_CLUSTER_NAME + "/" + alias;
+
+    AbstractAliasRequest request = Alias.add(session, alias, pwd);
+    assertTrue(request instanceof PutRequest);
+    assertEquals("Endpoint mismatch", expectedEndpointPath, 
request.getRequestURI().toString());
+
+    Callable callable = request.callable();
+    try {
+      callable.call();
+    } catch (Exception e) {
+      // expected
+    }
+
+//    assertEquals("Unexpected HTTP method.", HttpPut.METHOD_NAME, 
request.getRequest().getMethod());
 
 Review comment:
   Yes, forgot to clean up
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 352881)
    Time Spent: 50m  (was: 40m)

> Knox Shell support for remote Alias management
> ----------------------------------------------
>
>                 Key: KNOX-1410
>                 URL: https://issues.apache.org/jira/browse/KNOX-1410
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: KnoxShell
>    Affects Versions: 1.2.0
>            Reporter: Philip Zampino
>            Assignee: Philip Zampino
>            Priority: Major
>             Fix For: 1.5.0
>
>         Attachments: ExampleAliases.groovy
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> In an effort to minimize the need for an admin to work directly on a Knox 
> host, KnoxShell should support the ability to manage aliases so admins can do 
> this remotely.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to