diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-07 08:42:28 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-07 09:14:52 -0500 |
commit | a1492067cd56514f201e0b9ea5f0c0eb457988f5 (patch) | |
tree | 98ad7aa941fad3f2ec653d65086db1d5f20dd30d /mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap | |
parent | 359cee81f53a06b55cf84f29c0d69be9ca3f781b (diff) |
Revert Tenant Isolation /modelDistributions API
Tenant Isolation support PATCH again per AID.
Added ModelDistributionRequest class to Jersey Configuration.
PATCH JUnit generating 404 - Resource Not Present.
Revert Tenant Isolation /modelDistributions API to support PATCH again
per AID.
Change-Id: I08b4c2b0e080bb4615ebae435ecf18e5c438035d
Issue-ID: SO-1603
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap')
-rw-r--r-- | mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java index 9a8f4880f7..4e5cfaba48 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java @@ -24,13 +24,15 @@ import static org.hamcrest.Matchers.hasProperty; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.doNothing; +import java.io.IOException; + import javax.inject.Provider; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; @@ -38,21 +40,23 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.apihandler.common.ErrorNumbers; -import org.onap.so.apihandlerinfra.ApiHandlerApplication; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; +import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.web.util.UriComponentsBuilder; +import com.fasterxml.jackson.databind.ObjectMapper; public class ModelDistributionRequestTest extends BaseTest{ @@ -111,4 +115,22 @@ public class ModelDistributionRequestTest extends BaseTest{ assertEquals(200, response.getStatus()); } + @Test + public void testSuccess_PATCH() throws ApiException, IOException{ + String path = "/onap/so/infra/modelDistributions/v1/distributions/ff3514e3-5a33-55df-13ab-12abad84e7fa"; + ObjectMapper mapper = new ObjectMapper(); + Distribution distRequest = mapper.readValue(requestJSON, Distribution.class); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + HttpEntity<Distribution> entity = new HttpEntity<Distribution>(distRequest, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path)); + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.PATCH, entity, String.class); + assertEquals(200, response.getStatusCodeValue()); + + } + } |