YARN-10803. [JDK 11] TestRMFailoverProxyProvider and TestNoHaRMFailoverProxyProvider fails by ClassCastException. (#3068)
Reviewed-by: Takanobu Asanuma <tasanuma@apache.org>
This commit is contained in:
parent
b3c7254563
commit
9a17f97133
|
@ -140,9 +140,9 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
// Create a proxy and mock a RMProxy
|
// Create a proxy and mock a RMProxy
|
||||||
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
||||||
Class protocol = ApplicationClientProtocol.class;
|
Class protocol = ApplicationClientProtocol.class;
|
||||||
RMProxy mockRMProxy = mock(RMProxy.class);
|
RMProxy<Proxy> mockRMProxy = mock(RMProxy.class);
|
||||||
DefaultNoHARMFailoverProxyProvider <RMProxy> fpp =
|
DefaultNoHARMFailoverProxyProvider<Proxy> fpp =
|
||||||
new DefaultNoHARMFailoverProxyProvider<RMProxy>();
|
new DefaultNoHARMFailoverProxyProvider<>();
|
||||||
|
|
||||||
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Initialize failover proxy provider and get proxy from it.
|
// Initialize failover proxy provider and get proxy from it.
|
||||||
fpp.init(conf, mockRMProxy, protocol);
|
fpp.init(conf, mockRMProxy, protocol);
|
||||||
FailoverProxyProvider.ProxyInfo<RMProxy> actualProxy1 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy1 = fpp.getProxy();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
||||||
"expected proxy",
|
"expected proxy",
|
||||||
|
@ -180,7 +180,7 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy1.proxy);
|
fpp.performFailover(actualProxy1.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo<RMProxy> actualProxy2 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy2 = fpp.getProxy();
|
||||||
assertEquals("AutoRefreshRMFailoverProxyProvider " +
|
assertEquals("AutoRefreshRMFailoverProxyProvider " +
|
||||||
"doesn't generate expected proxy after failover",
|
"doesn't generate expected proxy after failover",
|
||||||
mockProxy1, actualProxy2.proxy);
|
mockProxy1, actualProxy2.proxy);
|
||||||
|
@ -208,9 +208,9 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
||||||
Proxy mockProxy2 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy2 = new TestProxy((proxy, method, args) -> null);
|
||||||
Class protocol = ApplicationClientProtocol.class;
|
Class protocol = ApplicationClientProtocol.class;
|
||||||
RMProxy mockRMProxy = mock(RMProxy.class);
|
RMProxy<Proxy> mockRMProxy = mock(RMProxy.class);
|
||||||
AutoRefreshNoHARMFailoverProxyProvider<RMProxy> fpp =
|
AutoRefreshNoHARMFailoverProxyProvider<Proxy> fpp =
|
||||||
new AutoRefreshNoHARMFailoverProxyProvider<RMProxy>();
|
new AutoRefreshNoHARMFailoverProxyProvider<>();
|
||||||
|
|
||||||
// generate two address with different ports.
|
// generate two address with different ports.
|
||||||
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
||||||
|
@ -224,7 +224,7 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Initialize proxy provider and get proxy from it.
|
// Initialize proxy provider and get proxy from it.
|
||||||
fpp.init(conf, mockRMProxy, protocol);
|
fpp.init(conf, mockRMProxy, protocol);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy1 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy1 = fpp.getProxy();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
||||||
"expected proxy",
|
"expected proxy",
|
||||||
|
@ -259,7 +259,7 @@ public class TestNoHaRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy1.proxy);
|
fpp.performFailover(actualProxy1.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy2 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy2 = fpp.getProxy();
|
||||||
assertEquals("AutoRefreshNoHARMFailoverProxyProvider " +
|
assertEquals("AutoRefreshNoHARMFailoverProxyProvider " +
|
||||||
"doesn't generate expected proxy after failover",
|
"doesn't generate expected proxy after failover",
|
||||||
mockProxy2, actualProxy2.proxy);
|
mockProxy2, actualProxy2.proxy);
|
||||||
|
|
|
@ -87,9 +87,9 @@ public class TestRMFailoverProxyProvider {
|
||||||
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
||||||
|
|
||||||
Class protocol = ApplicationClientProtocol.class;
|
Class protocol = ApplicationClientProtocol.class;
|
||||||
RMProxy mockRMProxy = mock(RMProxy.class);
|
RMProxy<Proxy> mockRMProxy = mock(RMProxy.class);
|
||||||
ConfiguredRMFailoverProxyProvider<RMProxy> fpp =
|
ConfiguredRMFailoverProxyProvider<Proxy> fpp =
|
||||||
new ConfiguredRMFailoverProxyProvider<RMProxy>();
|
new ConfiguredRMFailoverProxyProvider<>();
|
||||||
|
|
||||||
// generate two address with different ports.
|
// generate two address with different ports.
|
||||||
// Default port of yarn RM
|
// Default port of yarn RM
|
||||||
|
@ -104,7 +104,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Initialize failover proxy provider and get proxy from it.
|
// Initialize failover proxy provider and get proxy from it.
|
||||||
fpp.init(conf, mockRMProxy, protocol);
|
fpp.init(conf, mockRMProxy, protocol);
|
||||||
FailoverProxyProvider.ProxyInfo<RMProxy> actualProxy1 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy1 = fpp.getProxy();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"ConfiguredRMFailoverProxyProvider doesn't generate " +
|
"ConfiguredRMFailoverProxyProvider doesn't generate " +
|
||||||
"expected proxy",
|
"expected proxy",
|
||||||
|
@ -139,7 +139,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy1.proxy);
|
fpp.performFailover(actualProxy1.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy2 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy2 = fpp.getProxy();
|
||||||
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
||||||
"doesn't generate expected proxy after failover",
|
"doesn't generate expected proxy after failover",
|
||||||
mockProxy2, actualProxy2.proxy);
|
mockProxy2, actualProxy2.proxy);
|
||||||
|
@ -167,7 +167,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy2.proxy);
|
fpp.performFailover(actualProxy2.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy3 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy3 = fpp.getProxy();
|
||||||
|
|
||||||
// check the proxy is the same as the one we created before.
|
// check the proxy is the same as the one we created before.
|
||||||
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
||||||
|
@ -202,11 +202,10 @@ public class TestRMFailoverProxyProvider {
|
||||||
// Create three proxies and mock a RMProxy
|
// Create three proxies and mock a RMProxy
|
||||||
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy1 = new TestProxy((proxy, method, args) -> null);
|
||||||
Proxy mockProxy2 = new TestProxy((proxy, method, args) -> null);
|
Proxy mockProxy2 = new TestProxy((proxy, method, args) -> null);
|
||||||
Proxy mockProxy3 = new TestProxy((proxy, method, args) -> null);
|
|
||||||
Class protocol = ApplicationClientProtocol.class;
|
Class protocol = ApplicationClientProtocol.class;
|
||||||
RMProxy mockRMProxy = mock(RMProxy.class);
|
RMProxy<Proxy> mockRMProxy = mock(RMProxy.class);
|
||||||
AutoRefreshRMFailoverProxyProvider<RMProxy> fpp =
|
AutoRefreshRMFailoverProxyProvider<Proxy> fpp =
|
||||||
new AutoRefreshRMFailoverProxyProvider<RMProxy>();
|
new AutoRefreshRMFailoverProxyProvider<>();
|
||||||
|
|
||||||
// generate three address with different ports.
|
// generate three address with different ports.
|
||||||
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
InetSocketAddress mockAdd1 = new InetSocketAddress(RM1_PORT);
|
||||||
|
@ -222,7 +221,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Initialize failover proxy provider and get proxy from it.
|
// Initialize failover proxy provider and get proxy from it.
|
||||||
fpp.init(conf, mockRMProxy, protocol);
|
fpp.init(conf, mockRMProxy, protocol);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy1 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy1 = fpp.getProxy();
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
"AutoRefreshRMFailoverProxyProvider doesn't generate " +
|
||||||
"expected proxy",
|
"expected proxy",
|
||||||
|
@ -257,7 +256,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy1.proxy);
|
fpp.performFailover(actualProxy1.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy2 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy2 = fpp.getProxy();
|
||||||
assertEquals("AutoRefreshRMFailoverProxyProvider " +
|
assertEquals("AutoRefreshRMFailoverProxyProvider " +
|
||||||
"doesn't generate expected proxy after failover",
|
"doesn't generate expected proxy after failover",
|
||||||
mockProxy2, actualProxy2.proxy);
|
mockProxy2, actualProxy2.proxy);
|
||||||
|
@ -285,7 +284,7 @@ public class TestRMFailoverProxyProvider {
|
||||||
|
|
||||||
// Perform Failover and get proxy again from failover proxy provider
|
// Perform Failover and get proxy again from failover proxy provider
|
||||||
fpp.performFailover(actualProxy2.proxy);
|
fpp.performFailover(actualProxy2.proxy);
|
||||||
FailoverProxyProvider.ProxyInfo <RMProxy> actualProxy3 = fpp.getProxy();
|
FailoverProxyProvider.ProxyInfo<Proxy> actualProxy3 = fpp.getProxy();
|
||||||
|
|
||||||
// check the proxy is the same as the one we created before.
|
// check the proxy is the same as the one we created before.
|
||||||
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
assertEquals("ConfiguredRMFailoverProxyProvider " +
|
||||||
|
|
Loading…
Reference in New Issue