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=7f9da37db8f3ed89933dc337335d49c8ea84f577;hp=468b8fe5c10ee8db55d7fb8f285f9ef731214f03;hpb=f0af18429aec79a590835103fedd753ee5ea93a9;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 468b8fe..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; @@ -42,9 +41,10 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.oran.datafile.commons.FileServerData; 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));