X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=datafilecollector%2Fsrc%2Ftest%2Fjava%2Forg%2Foran%2Fdatafile%2Fhttp%2FDfcHttpsClientTest.java;h=5936a0967a395fa620e0a4c352f5ded98c7c1dea;hb=69316aa635c8f28557a38aab90e3362295d0725f;hp=c74edbd96bf7cd08c4bc4bf431ec4f54c758b966;hpb=7ba76d4f4c0f92c874686d60abd12ef0322f01b0;p=nonrtric%2Fplt%2Franpm.git diff --git a/datafilecollector/src/test/java/org/oran/datafile/http/DfcHttpsClientTest.java b/datafilecollector/src/test/java/org/oran/datafile/http/DfcHttpsClientTest.java index c74edbd..5936a09 100644 --- a/datafilecollector/src/test/java/org/oran/datafile/http/DfcHttpsClientTest.java +++ b/datafilecollector/src/test/java/org/oran/datafile/http/DfcHttpsClientTest.java @@ -16,7 +16,6 @@ */ package org.oran.datafile.http; -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; @@ -45,6 +44,7 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.oran.datafile.exceptions.DatafileTaskException; import org.oran.datafile.exceptions.NonRetryableDatafileTaskException; import org.oran.datafile.model.FileServerData; +import org.oran.datafile.oauth2.SecurityContext; @ExtendWith(MockitoExtension.class) class DfcHttpsClientTest { @@ -66,28 +66,8 @@ class DfcHttpsClientTest { @BeforeEach public void setup() { - dfcHttpsClientSpy = spy(new DfcHttpsClient(createFileServerData(), connectionManager)); - } - - @Test - void fileServerData_properLocationBasicAuth() throws Exception { - boolean result = dfcHttpsClientSpy.basicAuthValidNotPresentOrThrow(); - assertEquals(true, result); - } - - @Test - void fileServerData_properLocationNoBasicAuth() throws Exception { - dfcHttpsClientSpy = spy(new DfcHttpsClient(emptyUserInFileServerData(), connectionManager)); - - boolean result = dfcHttpsClientSpy.basicAuthValidNotPresentOrThrow(); - assertEquals(false, result); - } - - @Test - void fileServerData_improperAuthDataExceptionOccurred() throws Exception { - dfcHttpsClientSpy = spy(new DfcHttpsClient(invalidUserInFileServerData(), connectionManager)); - - assertThrows(DatafileTaskException.class, () -> dfcHttpsClientSpy.basicAuthValidNotPresentOrThrow()); + SecurityContext ctx = new SecurityContext(""); + dfcHttpsClientSpy = spy(new DfcHttpsClient(ctx, createFileServerData(), connectionManager)); } @Test @@ -109,7 +89,8 @@ class DfcHttpsClientTest { @Test void dfcHttpsClient_flow_successfulCallWithJWTAndResponseProcessing() throws Exception { FileServerData serverData = jWTTokenInFileServerData(); - dfcHttpsClientSpy = spy(new DfcHttpsClient(serverData, connectionManager)); + SecurityContext ctx = new SecurityContext(""); + dfcHttpsClientSpy = spy(new DfcHttpsClient(ctx, serverData, connectionManager)); doReturn(HttpClientResponseHelper.APACHE_RESPONSE_OK).when(dfcHttpsClientSpy) .executeHttpClient(any(HttpGet.class));