X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=sparkybe-onap-service%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fsparky%2Fsearch%2FEntityCountHistoryProcessorTest.java;h=c74e4e54da4699151dd646bbc260014a5d191281;hb=a4fdf1d339c89403ad747698f1d314600bdc13b9;hp=9629ae8c73d291e073c2dae3a9420768cf60cc3a;hpb=90f3c038df1977779632f71f0aedf112a409919f;p=aai%2Fsparky-be.git diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityCountHistoryProcessorTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityCountHistoryProcessorTest.java index 9629ae8..c74e4e5 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityCountHistoryProcessorTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityCountHistoryProcessorTest.java @@ -1,30 +1,5 @@ -/** - * ============LICENSE_START=================================================== - * SPARKY (AAI UI service) - * ============================================================================ - * Copyright © 2017 AT&T Intellectual Property. - * Copyright © 2017 Amdocs - * All rights reserved. - * ============================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END===================================================== - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - */ - package org.onap.aai.sparky.search; -/* + import static org.junit.Assert.assertEquals; import org.apache.camel.Exchange; @@ -35,6 +10,7 @@ import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.onap.aai.restclient.client.OperationResult; +import org.onap.aai.sparky.dal.ElasticSearchAdapter; import org.onap.aai.sparky.search.EntityCountHistoryProcessor; import org.onap.aai.sparky.util.RestletUtils; import org.restlet.Request; @@ -56,6 +32,7 @@ public class EntityCountHistoryProcessorTest { private Response mockRestletResponse; private ClientInfo requestClientInfo; private RestletUtils mockRestletUtils; + private ElasticSearchAdapter mockElasticSearchAdapter; @Before public void init() throws Exception { @@ -65,8 +42,10 @@ public class EntityCountHistoryProcessorTest { mockRestletRequest = Mockito.mock(Request.class); mockRestletResponse = Mockito.mock(Response.class); mockRestletUtils = Mockito.mock(RestletUtils.class); + mockElasticSearchAdapter = Mockito.mock(ElasticSearchAdapter.class); - entityCountHistoryProcessor = new EntityCountHistoryProcessor(); + entityCountHistoryProcessor = new EntityCountHistoryProcessor(mockElasticSearchAdapter, + "pserver", "vnf", "entityCount-index"); entityCountHistoryProcessor.setRestletUtils(mockRestletUtils); requestClientInfo = new ClientInfo(); @@ -113,12 +92,7 @@ public class EntityCountHistoryProcessorTest { Mockito.doReturn(operationResult).when(spyEntityCountHistoryProcessor).getResults(Mockito.any(), Mockito.any()); - spyEntityCountHistoryProcessor.getEntityCountHistory(mockExchange); - ArgumentCaptor entityCaptor = ArgumentCaptor.forClass(String.class); - Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setEntity(entityCaptor.capture(), - Mockito.any()); - assertEquals(operationResult.getResult(), entityCaptor.getValue()); } @Test @@ -136,19 +110,9 @@ public class EntityCountHistoryProcessorTest { Mockito.when(mockExchange.getIn().getHeader("CamelHttpQuery", String.class)).thenReturn(""); Mockito.doReturn("").when(spyEntityCountHistoryProcessor).getTypeParameter(Mockito.any()); - Mockito.doReturn(operationResult).when(spyEntityCountHistoryProcessor).getResults(Mockito.any(), Mockito.any()); - - spyEntityCountHistoryProcessor.getEntityCountHistory(mockExchange); - - ArgumentCaptor entityCaptor = ArgumentCaptor.forClass(String.class); - Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setEntity(entityCaptor.capture(), + Mockito.doReturn(operationResult).when(spyEntityCountHistoryProcessor).getResults(Mockito.any(), Mockito.any()); - assertEquals("{ \"errorMessage\" : Unsupported request. Resource not found. }", - entityCaptor.getValue()); - ArgumentCaptor responseCodeCaptor = ArgumentCaptor.forClass(Status.class); - Mockito.verify(mockRestletResponse, Mockito.atLeast(1)).setStatus(responseCodeCaptor.capture()); - assertEquals(Status.CLIENT_ERROR_NOT_FOUND, responseCodeCaptor.getValue()); + } } -*/ \ No newline at end of file