mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 11:52:28 +01:00
Adjust tests to fix a problem with the container builders (https://github.com/khos2ow/cloudstack-deb-builder) (#4668)
* Changes to allow builders containers to build ACS Co-authored-by: Daniel Augusto Veronezi Salvador <daniel@scclouds.com.br>
This commit is contained in:
parent
cc8bee7223
commit
e1f3179446
@ -41,6 +41,7 @@ import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ -57,12 +58,6 @@ public class RootCAProviderTest {
|
||||
f.set(provider, o);
|
||||
}
|
||||
|
||||
private void overrideDefaultConfigValue(final ConfigKey configKey, final String name, final Object o) throws IllegalAccessException, NoSuchFieldException {
|
||||
Field f = ConfigKey.class.getDeclaredField(name);
|
||||
f.setAccessible(true);
|
||||
f.set(configKey, o);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
caKeyPair = CertUtils.generateRandomKeyPair(1024);
|
||||
@ -133,17 +128,17 @@ public class RootCAProviderTest {
|
||||
|
||||
@Test
|
||||
public void testCreateSSLEngineWithoutAuthStrictness() throws Exception {
|
||||
overrideDefaultConfigValue(RootCAProvider.rootCAAuthStrictness, "_defaultValue", "false");
|
||||
provider.rootCAAuthStrictness = Mockito.mock(ConfigKey.class);
|
||||
Mockito.when(provider.rootCAAuthStrictness.value()).thenReturn(Boolean.FALSE);
|
||||
final SSLEngine e = provider.createSSLEngine(SSLUtils.getSSLContext(), "/1.2.3.4:5678", null);
|
||||
Assert.assertFalse(e.getUseClientMode());
|
||||
Assert.assertFalse(e.getNeedClientAuth());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateSSLEngineWithAuthStrictness() throws Exception {
|
||||
overrideDefaultConfigValue(RootCAProvider.rootCAAuthStrictness, "_defaultValue", "true");
|
||||
provider.rootCAAuthStrictness = Mockito.mock(ConfigKey.class);
|
||||
Mockito.when(provider.rootCAAuthStrictness.value()).thenReturn(Boolean.TRUE);
|
||||
final SSLEngine e = provider.createSSLEngine(SSLUtils.getSSLContext(), "/1.2.3.4:5678", null);
|
||||
Assert.assertFalse(e.getUseClientMode());
|
||||
Assert.assertTrue(e.getNeedClientAuth());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user