knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [knox] branch master updated: KNOX-2122 - Remove deprecated API usages (#194)
Date Wed, 13 Nov 2019 00:29:02 GMT
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 14ac290  KNOX-2122 - Remove deprecated API usages (#194)
14ac290 is described below

commit 14ac2900373e641423bf91cfb5d2faf00bed1e52
Author: Kevin Risden <risdenk@users.noreply.github.com>
AuthorDate: Tue Nov 12 19:28:54 2019 -0500

    KNOX-2122 - Remove deprecated API usages (#194)
    
    Signed-off-by: Kevin Risden <krisden@apache.org>
---
 .../ha/provider/impl/DefaultHaProviderTest.java    |  5 +-
 .../impl/EncryptDecryptUriProcessorTest.java       |  5 +-
 .../rewrite/impl/UrlRewriteResponseTest.java       |  2 +-
 .../org/apache/knox/gateway/GatewayServer.java     |  4 +-
 .../services/security/impl/JettySSLService.java    |  2 +-
 .../knox/gateway/GatewayGlobalConfigTest.java      | 18 +++----
 .../topology/xml/TopologyRulesModuleTest.java      |  2 +-
 ...HashicorpVaultClientAuthenticationProvider.java |  2 +-
 .../config/remote/zk/CuratorClientService.java     |  4 +-
 .../java/org/apache/hadoop/http/HttpServer2.java   |  2 +-
 .../java/org/apache/hadoop/http/HttpServer2.java   |  2 +-
 .../apache/knox/gateway/GatewayBasicFuncTest.java  | 60 +++++++++++-----------
 .../knox/gateway/util/urltemplate/MatcherTest.java |  3 +-
 13 files changed, 56 insertions(+), 55 deletions(-)

diff --git a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/DefaultHaProviderTest.java
b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/DefaultHaProviderTest.java
index 71b3abc..5f924f6 100644
--- a/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/DefaultHaProviderTest.java
+++ b/gateway-provider-ha/src/test/java/org/apache/knox/gateway/ha/provider/impl/DefaultHaProviderTest.java
@@ -24,7 +24,8 @@ import org.junit.Test;
 import java.util.ArrayList;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.isIn;
+import static org.hamcrest.collection.IsIn.in;
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
@@ -60,7 +61,7 @@ public class DefaultHaProviderTest {
       assertNull(provider.getActiveURL("bar"));
       String url = provider.getActiveURL("foo");
       assertNotNull(url);
-      assertThat(url, isIn(urls));
+      assertThat(url, is(in(urls)));
    }
 
    @Test
diff --git a/gateway-provider-rewrite-step-encrypt-uri/src/test/java/org/apache/knox/gateway/encrypturi/impl/EncryptDecryptUriProcessorTest.java
b/gateway-provider-rewrite-step-encrypt-uri/src/test/java/org/apache/knox/gateway/encrypturi/impl/EncryptDecryptUriProcessorTest.java
index d317a04..20d79e9 100644
--- a/gateway-provider-rewrite-step-encrypt-uri/src/test/java/org/apache/knox/gateway/encrypturi/impl/EncryptDecryptUriProcessorTest.java
+++ b/gateway-provider-rewrite-step-encrypt-uri/src/test/java/org/apache/knox/gateway/encrypturi/impl/EncryptDecryptUriProcessorTest.java
@@ -39,11 +39,10 @@ import java.util.ServiceLoader;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.emptyOrNullString;
 import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.text.IsEmptyString.isEmptyOrNullString;
 import static org.junit.Assert.fail;
 
-
 public class EncryptDecryptUriProcessorTest {
 
   @SuppressWarnings("rawtypes")
@@ -115,7 +114,7 @@ public class EncryptDecryptUriProcessorTest {
     assertThat( encodedValue.getValue(), notNullValue() );
     assertThat( encodedValue.getValue().resolve( encryptedValueParamName ).size(), is( 1
) );
     String encryptedAdrress = encodedValue.getValue().resolve( encryptedValueParamName ).get(
0 );
-    assertThat( encryptedAdrress, not( isEmptyOrNullString() ) );
+    assertThat( encryptedAdrress, not( is(emptyOrNullString()) ) );
     assertThat( encryptedAdrress, not( "{host}:{port}" ) );
     assertThat( encryptedAdrress, not( "hdp:8088" ) );
 
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
index 4124761..14d9a6a 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponseTest.java
@@ -41,7 +41,7 @@ import java.util.zip.GZIPOutputStream;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsCollectionContaining.hasItems;
+import static org.hamcrest.core.IsIterableContaining.hasItems;
 
 public class UrlRewriteResponseTest {
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index 9fa36ae..e3ef3b6 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -257,8 +257,8 @@ public class GatewayServer {
 
   private static void validateConfigurableGatewayDirectories(GatewayConfig config) throws
GatewayConfigurationException {
     final Set<String> errors = new HashSet<>();
-    checkIfDirectoryExistsAndCanBeRead(Paths.get(config.getGatewayConfDir()), GatewayConfig.GATEWAY_CONF_HOME_VAR,
errors);
-    checkIfDirectoryExistsAndCanBeWritten(Paths.get(config.getGatewayDataDir()), GatewayConfig.GATEWAY_DATA_HOME_VAR,
errors);
+    checkIfDirectoryExistsAndCanBeRead(Paths.get(config.getGatewayConfDir()), GatewayConfig.KNOX_GATEWAY_CONF_DIR_VAR,
errors);
+    checkIfDirectoryExistsAndCanBeWritten(Paths.get(config.getGatewayDataDir()), GatewayConfig.KNOX_GATEWAY_DATA_DIR,
errors);
 
     if (!errors.isEmpty()) {
       throw new GatewayConfigurationException(errors);
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/JettySSLService.java
b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/JettySSLService.java
index 31d718a..6e79f36 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/JettySSLService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/JettySSLService.java
@@ -136,7 +136,7 @@ public class JettySSLService implements SSLService {
     String identityKeystoreType = config.getIdentityKeystoreType();
     String identityKeyAlias = config.getIdentityKeyAlias();
 
-    SslContextFactory sslContextFactory = new SslContextFactory( true );
+    SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
     sslContextFactory.setCertAlias( identityKeyAlias );
     sslContextFactory.setKeyStoreType(identityKeystoreType);
     sslContextFactory.setKeyStorePath(identityKeystorePath );
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
index 5c922e9..42da47e 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/GatewayGlobalConfigTest.java
@@ -102,7 +102,7 @@ public class GatewayGlobalConfigTest {
   public void testForUpdatedDeploymentDir() {
     String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName);
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue(("target/test").equalsIgnoreCase(config.getGatewayDeploymentDir()));
   }
@@ -111,7 +111,7 @@ public class GatewayGlobalConfigTest {
   public void testDefaultDeploymentDir() {
     String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName);
     GatewayConfig config = new GatewayConfigImpl();
     assertThat(config.getGatewayDeploymentDir(), is(homeDirName + File.separator + "deployments"));
   }
@@ -120,7 +120,7 @@ public class GatewayGlobalConfigTest {
   public void testForDefaultSecurityDataDir() {
     String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName);
     GatewayConfig config = new GatewayConfigImpl();
     assertThat(config.getGatewaySecurityDir(), is(homeDirName + File.separator + "security"));
   }
@@ -129,7 +129,7 @@ public class GatewayGlobalConfigTest {
   public void testForUpdatedSecurityDataDir() {
     String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName);
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName);
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue(("target/test").equalsIgnoreCase(config.getGatewaySecurityDir()));
   }
@@ -137,7 +137,7 @@ public class GatewayGlobalConfigTest {
   @Test
   public void testForDataDirSetAsSystemProperty() {
     String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName + File.separator
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName + File.separator
         + "DataDirSystemProperty");
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue((homeDirName + File.separator + "DataDirSystemProperty").equalsIgnoreCase(config
@@ -148,7 +148,7 @@ public class GatewayGlobalConfigTest {
   public void testForDataDirSetAsConfiguration() {
     String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.clearProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR);
+    System.clearProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR);
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue(("target/testDataDir").equalsIgnoreCase(config
         .getGatewayDataDir()));
@@ -158,7 +158,7 @@ public class GatewayGlobalConfigTest {
   public void testForDefaultDataDir() {
     String homeDirName = getHomeDirName("conf-site/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.clearProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR);
+    System.clearProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR);
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue((homeDirName + File.separator + "data").equalsIgnoreCase(config.getGatewayDataDir()));
   }
@@ -171,7 +171,7 @@ public class GatewayGlobalConfigTest {
   public void testDataDirSetAsBothSystemPropertyAndConfig() {
     String homeDirName = getHomeDirName("conf-demo/conf/gateway-site.xml");
     System.setProperty(GatewayConfigImpl.GATEWAY_HOME_VAR, homeDirName);
-    System.setProperty(GatewayConfigImpl.GATEWAY_DATA_HOME_VAR, homeDirName + File.separator
+    System.setProperty(GatewayConfigImpl.KNOX_GATEWAY_DATA_DIR, homeDirName + File.separator
         + "DataDirSystemProperty");
     GatewayConfig config = new GatewayConfigImpl();
     assertTrue((homeDirName + File.separator + "DataDirSystemProperty").equalsIgnoreCase(config
@@ -188,4 +188,4 @@ public class GatewayGlobalConfigTest {
     config = new GatewayConfigImpl();
     assertEquals("target/test", config.getGatewayServicesDir());
   }
-}
\ No newline at end of file
+}
diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/topology/xml/TopologyRulesModuleTest.java
b/gateway-server/src/test/java/org/apache/knox/gateway/topology/xml/TopologyRulesModuleTest.java
index 8e5e1e8..ffe54f5 100644
--- a/gateway-server/src/test/java/org/apache/knox/gateway/topology/xml/TopologyRulesModuleTest.java
+++ b/gateway-server/src/test/java/org/apache/knox/gateway/topology/xml/TopologyRulesModuleTest.java
@@ -41,7 +41,7 @@ import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.collection.IsMapContaining.hasEntry;
 import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsCollectionContaining.hasItem;
+import static org.hamcrest.core.IsIterableContaining.hasItem;
 import static org.hamcrest.core.IsNull.notNullValue;
 import static org.hamcrest.core.IsNull.nullValue;
 import static org.junit.Assert.assertEquals;
diff --git a/gateway-service-hashicorp-vault/src/main/java/org/apache/knox/gateway/backend/hashicorp/vault/authentication/KubernetesHashicorpVaultClientAuthenticationProvider.java
b/gateway-service-hashicorp-vault/src/main/java/org/apache/knox/gateway/backend/hashicorp/vault/authentication/KubernetesHashicorpVaultClientAuthenticationProvider.java
index 11f3047..3ec8032 100644
--- a/gateway-service-hashicorp-vault/src/main/java/org/apache/knox/gateway/backend/hashicorp/vault/authentication/KubernetesHashicorpVaultClientAuthenticationProvider.java
+++ b/gateway-service-hashicorp-vault/src/main/java/org/apache/knox/gateway/backend/hashicorp/vault/authentication/KubernetesHashicorpVaultClientAuthenticationProvider.java
@@ -23,11 +23,11 @@ import org.springframework.http.client.ClientHttpRequestFactory;
 import org.springframework.vault.authentication.ClientAuthentication;
 import org.springframework.vault.authentication.KubernetesAuthentication;
 import org.springframework.vault.authentication.KubernetesAuthenticationOptions;
+import org.springframework.vault.client.ClientHttpRequestFactoryFactory;
 import org.springframework.vault.client.SimpleVaultEndpointProvider;
 import org.springframework.vault.client.VaultClients;
 import org.springframework.vault.client.VaultEndpoint;
 import org.springframework.vault.client.VaultEndpointProvider;
-import org.springframework.vault.config.ClientHttpRequestFactoryFactory;
 import org.springframework.vault.support.ClientOptions;
 import org.springframework.vault.support.SslConfiguration;
 import org.springframework.web.client.RestOperations;
diff --git a/gateway-service-remoteconfig/src/main/java/org/apache/knox/gateway/service/config/remote/zk/CuratorClientService.java
b/gateway-service-remoteconfig/src/main/java/org/apache/knox/gateway/service/config/remote/zk/CuratorClientService.java
index 445b326..b77c6a6 100644
--- a/gateway-service-remoteconfig/src/main/java/org/apache/knox/gateway/service/config/remote/zk/CuratorClientService.java
+++ b/gateway-service-remoteconfig/src/main/java/org/apache/knox/gateway/service/config/remote/zk/CuratorClientService.java
@@ -39,7 +39,7 @@ import org.apache.knox.gateway.service.config.remote.config.RemoteConfigurationR
 import org.apache.knox.gateway.services.ServiceLifecycleException;
 import org.apache.knox.gateway.services.security.AliasService;
 import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.client.ZooKeeperSaslClient;
+import org.apache.zookeeper.client.ZKClientConfig;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Id;
 import org.apache.zookeeper.data.Stat;
@@ -56,7 +56,7 @@ import java.util.Map;
  */
 class CuratorClientService implements ZooKeeperClientService {
 
-    private static final String LOGIN_CONTEXT_NAME_PROPERTY = ZooKeeperSaslClient.LOGIN_CONTEXT_NAME_KEY;
+    private static final String LOGIN_CONTEXT_NAME_PROPERTY = ZKClientConfig.LOGIN_CONTEXT_NAME_KEY;
 
     private static final String DEFAULT_LOGIN_CONTEXT_NAME = "Client";
 
diff --git a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
index 0b3daee..fedc854 100644
--- a/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
+++ b/gateway-test-release/webhdfs-kerb-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
@@ -505,7 +505,7 @@ public final class HttpServer2 implements FilterContainer {
       httpConfig.addCustomizer(new SecureRequestCustomizer());
       ServerConnector conn = createHttpChannelConnector(server, httpConfig);
 
-      SslContextFactory sslContextFactory = new SslContextFactory();
+      SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
       sslContextFactory.setNeedClientAuth(needsClientAuth);
       sslContextFactory.setKeyManagerPassword(keyPassword);
       if (keyStore != null) {
diff --git a/gateway-test-release/webhdfs-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
b/gateway-test-release/webhdfs-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
index dcc08b4..a14bfd0 100644
--- a/gateway-test-release/webhdfs-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
+++ b/gateway-test-release/webhdfs-test/src/test/java/org/apache/hadoop/http/HttpServer2.java
@@ -506,7 +506,7 @@ public final class HttpServer2 implements FilterContainer {
       httpConfig.addCustomizer(new SecureRequestCustomizer());
       ServerConnector conn = createHttpChannelConnector(server, httpConfig);
 
-      SslContextFactory sslContextFactory = new SslContextFactory();
+      SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
       sslContextFactory.setNeedClientAuth(needsClientAuth);
       sslContextFactory.setKeyManagerPassword(keyPassword);
       if (keyStore != null) {
diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
index 307f007..a77524c 100644
--- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
+++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java
@@ -102,8 +102,10 @@ import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.startsWith;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.emptyString;
 import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.text.IsEmptyString.isEmptyString;
+import static org.hamcrest.collection.IsIn.in;
+import static org.hamcrest.collection.IsIn.oneOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.xmlmatchers.XmlMatchers.isEquivalentTo;
@@ -2284,16 +2286,16 @@ public class GatewayBasicFuncTest {
 //         .log().all()
         .statusCode( HttpStatus.SC_OK )
         .contentType( contentType )
-        .body( "apps.app[0].trackingUrl", isEmptyString() )
+        .body( "apps.app[0].trackingUrl", is(emptyString()) )
         .body( "apps.app[1].trackingUrl",
             anyOf(
                 startsWith( "http://" + gatewayHostName + ":" + gatewayAddress.getPort()
+ "/" ),
                 startsWith( "http://" + gatewayAddrName + ":" + gatewayAddress.getPort()
+ "/" ) ) )
-        .body( "apps.app[2].trackingUrl", isEmptyString() )
-        .body( "apps.app[0].amContainerLogs", isEmptyString() )
-        .body( "apps.app[1].amContainerLogs", isEmptyString() )
-        .body( "apps.app[0].amHostHttpAddress", isEmptyString() )
-        .body( "apps.app[1].amHostHttpAddress", isEmptyString() )
+        .body( "apps.app[2].trackingUrl", is(emptyString()))
+        .body( "apps.app[0].amContainerLogs", is(emptyString()) )
+        .body( "apps.app[1].amContainerLogs", is(emptyString()) )
+        .body( "apps.app[0].amHostHttpAddress", is(emptyString()) )
+        .body( "apps.app[1].amHostHttpAddress", is(emptyString()) )
         .body( "apps.app[2].id", is( "application_1399541193872_0009" ) )
         .when()
         .get(gatewayPath + gatewayPathQuery);
@@ -2445,11 +2447,11 @@ public class GatewayBasicFuncTest {
               startsWith( "http://" + gatewayHostName + ":" + gatewayAddress.getPort() +
"/" ),
               startsWith( "http://" + gatewayAddrName + ":" + gatewayAddress.getPort() +
"/" ) ) );
     } else {
-      response.body( "app.trackingUrl", isEmptyString() );
+      response.body( "app.trackingUrl", is(emptyString()) );
     }
 
-    response.body( "app.amContainerLogs", isEmptyString() )
-        .body( "app.amHostHttpAddress", isEmptyString() )
+    response.body( "app.amContainerLogs", is(emptyString()) )
+        .body( "app.amHostHttpAddress", is(emptyString()) )
         .when()
         .get( gatewayPath );
 
@@ -2550,9 +2552,9 @@ public class GatewayBasicFuncTest {
 //         .log().all()
         .statusCode( HttpStatus.SC_OK )
         .contentType( contentType )
-        .body( "appAttempts.appAttempt[0].nodeHttpAddress", isEmptyString() )
+        .body( "appAttempts.appAttempt[0].nodeHttpAddress", is(emptyString()) )
         .body( "appAttempts.appAttempt[0].nodeId", not( containsString( "localhost:50060"
) ) )
-        .body( "appAttempts.appAttempt[0].logsLink", isEmptyString() )
+        .body( "appAttempts.appAttempt[0].logsLink", is(emptyString()) )
         .when()
         .get( gatewayPath );
 
@@ -2618,8 +2620,8 @@ public class GatewayBasicFuncTest {
         .statusCode( HttpStatus.SC_OK )
         .contentType( contentType )
         .body( "nodes.node[0].id", not( containsString( nodeId ) ) )
-        .body( "nodes.node[0].nodeHostName", isEmptyString() )
-        .body( "nodes.node[0].nodeHTTPAddress", isEmptyString() )
+        .body( "nodes.node[0].nodeHostName", is(emptyString()) )
+        .body( "nodes.node[0].nodeHTTPAddress", is(emptyString()) )
         .when()
         .get( gatewayPath + gatewayPathQuery ).getBody().path( "nodes.node[0].id" );
 
@@ -2642,8 +2644,8 @@ public class GatewayBasicFuncTest {
         .statusCode( HttpStatus.SC_OK )
         .contentType( contentType )
         .body( "node.id", not( containsString( nodeId ) ) )
-        .body( "node.nodeHostName", isEmptyString() )
-        .body( "node.nodeHTTPAddress", isEmptyString() )
+        .body( "node.nodeHostName", is(emptyString()) )
+        .body( "node.nodeHTTPAddress", is(emptyString()) )
         .when()
         .get( gatewayPath + encryptedNodeId );
 
@@ -2761,9 +2763,9 @@ public class GatewayBasicFuncTest {
     path = "/proxy/application_1399541193872_0036/ws/v1/mapreduce/jobs/job_1399541193872_0036/jobattempts";
     resource = "yarn/proxy-mapreduce-job-attempts";
     matchers.clear();
-    matchers.put( "jobAttempts.jobAttempt[0].nodeHttpAddress", isEmptyString() );
+    matchers.put( "jobAttempts.jobAttempt[0].nodeHttpAddress", is(emptyString()) );
     matchers.put( "jobAttempts.jobAttempt[0].nodeId", not( containsString( "host.yarn.com:45454"
) ) );
-    matchers.put( "jobAttempts.jobAttempt[0].logsLink", isEmptyString() );
+    matchers.put( "jobAttempts.jobAttempt[0].logsLink", is(emptyString()) );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.JSON, matchers );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.XML, matchers );
 
@@ -2786,14 +2788,14 @@ public class GatewayBasicFuncTest {
     path = "/proxy/application_1399541193872_0036/ws/v1/mapreduce/jobs/job_1399541193872_0036/tasks/task_1399541193872_0036_r_00/attempts";
     resource = "yarn/proxy-mapreduce-task-attempts";
     matchers.clear();
-    matchers.put( "taskAttempts.taskAttempt[0].nodeHttpAddress", isEmptyString() );
+    matchers.put( "taskAttempts.taskAttempt[0].nodeHttpAddress", is(emptyString()) );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.JSON, matchers );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.XML, matchers );
 
     path = "/proxy/application_1399541193872_0036/ws/v1/mapreduce/jobs/job_1399541193872_0036/tasks/task_1399541193872_0036_r_00/attempts/attempt_1399541193872_0036_r_000000_0";
     resource = "yarn/proxy-mapreduce-task-attempt";
     matchers.clear();
-    matchers.put( "taskAttempt.nodeHttpAddress", isEmptyString() );
+    matchers.put( "taskAttempt.nodeHttpAddress", is(emptyString()) );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.JSON, matchers );
     getYarnRmProxyData( encryptedQuery, path, resource, ContentType.XML, matchers );
 
@@ -3418,12 +3420,12 @@ public class GatewayBasicFuncTest {
     driver.getMock("STORM")
         .expect()
         .method("GET")
-        .header("X-Forwarded-Host", Matchers.isOneOf(gatewayHostName + ":" + gatewayPort,
gatewayAddrName + ":" + gatewayPort))
+        .header("X-Forwarded-Host", Matchers.is(oneOf(gatewayHostName + ":" + gatewayPort,
gatewayAddrName + ":" + gatewayPort)))
         .header("X-Forwarded-Proto", "http")
         .header("X-Forwarded-Port", Integer.toString(gatewayPort))
         .header("X-Forwarded-Context", "/gateway/cluster")
-        .header( "X-Forwarded-Server", Matchers.isOneOf( gatewayHostName, gatewayAddrName
) )
-        .header( "X-Forwarded-For", Matchers.isOneOf( gatewayHostName, gatewayAddrName )
)
+        .header( "X-Forwarded-Server", Matchers.is(oneOf( gatewayHostName, gatewayAddrName
) ))
+        .header( "X-Forwarded-For", Matchers.is(oneOf( gatewayHostName, gatewayAddrName )
))
         .pathInfo( path )
         .queryParam( "user.name", username )
         .respond()
@@ -3476,7 +3478,7 @@ public class GatewayBasicFuncTest {
         .header("X-Forwarded-Proto", scheme)
         .header("X-Forwarded-Port", port)
         .header("X-Forwarded-Context", "/gateway/cluster")
-        .header("X-Forwarded-Server", Matchers.isOneOf( gatewayHostName, gatewayAddrName
) )
+        .header("X-Forwarded-Server", Matchers.is(oneOf( gatewayHostName, gatewayAddrName
) ))
         .header("X-Forwarded-For", Matchers.containsString("what, boo"))
         .pathInfo(path)
         .queryParam("user.name", username)
@@ -3516,7 +3518,7 @@ public class GatewayBasicFuncTest {
         .header("X-Forwarded-Proto", scheme)
         .header("X-Forwarded-Port", port)
         .header("X-Forwarded-Context", "/gateway/cluster")
-        .header("X-Forwarded-Server", Matchers.isOneOf( gatewayHostName, gatewayAddrName
) )
+        .header("X-Forwarded-Server", Matchers.is(oneOf( gatewayHostName, gatewayAddrName
) ))
         .header("X-Forwarded-For", Matchers.containsString("what, boo"))
         .pathInfo(path)
         .queryParam("user.name", username)
@@ -3559,7 +3561,7 @@ public class GatewayBasicFuncTest {
         .header("X-Forwarded-Proto", scheme)
         .header("X-Forwarded-Port", port)
         .header("X-Forwarded-Context", "/gateway/cluster")
-        .header("X-Forwarded-Server", Matchers.isOneOf( gatewayHostName, gatewayAddrName
) )
+        .header("X-Forwarded-Server", Matchers.is(oneOf( gatewayHostName, gatewayAddrName
) ))
         .header("X-Forwarded-For", Matchers.containsString("what, boo"))
         .queryParam("op", "CREATE")
         .queryParam( "user.name", username )
@@ -4155,7 +4157,7 @@ public class GatewayBasicFuncTest {
         .queryParam( "recursive", recursive )
         .then()
         //.log().all()
-        .statusCode( Matchers.isIn(ArrayUtils.toObject(status)) )
+        .statusCode( Matchers.is(in(ArrayUtils.toObject(status))) )
         .when()
         .delete( driver.getUrl( "WEBHDFS" ) + "/v1" + file + ( driver.isUseGateway() ? ""
: "?user.name=" + user ) );
     driver.assertComplete();
@@ -4250,7 +4252,7 @@ public class GatewayBasicFuncTest {
         .formParam( "statusdir", statusDir )
         .then()
         //.log().all();
-        .statusCode( Matchers.isIn(ArrayUtils.toObject(status)) )
+        .statusCode( Matchers.is(in(ArrayUtils.toObject(status))) )
         .contentType( "application/json" )
         //.content( "boolean", equalTo( true ) )
         .when()
@@ -4283,7 +4285,7 @@ public class GatewayBasicFuncTest {
         .formParam( "statusdir", statusDir )
         .then()
         //.log().all()
-        .statusCode( Matchers.isIn(ArrayUtils.toObject(status)) )
+        .statusCode( Matchers.is(in(ArrayUtils.toObject(status))) )
         .contentType( "application/json" )
         //.content( "boolean", equalTo( true ) )
         .when()
diff --git a/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/MatcherTest.java
b/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/MatcherTest.java
index 03fc713..be30f7d 100644
--- a/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/MatcherTest.java
+++ b/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/MatcherTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.knox.gateway.util.urltemplate;
 
-
 import org.apache.knox.test.category.FastTests;
 import org.apache.knox.test.category.UnitTests;
 import org.junit.Test;
@@ -33,7 +32,7 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.CoreMatchers.sameInstance;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.IsCollectionContaining.hasItem;
+import static org.hamcrest.core.IsIterableContaining.hasItem;
 import static org.hamcrest.core.IsNull.notNullValue;
 
 //TODO: Test to make sure that extra unmatched query parameters prevent a match.


Mime
View raw message