From dfdb5a1d8cff4327a88220dfcc7f8df31814bf65 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 10 Sep 2018 09:28:05 -0400 Subject: sparate beans and repositories Seperate out Beans and repositories for RequestDB Change-Id: I67d6597d580e9828b6bb8faafaea7e09cc6467c0 Issue-ID: SO-999 Signed-off-by: Benjamin, Max (mb388a) --- .../src/test/java/org/onap/so/BaseTest.java | 34 ---- .../src/test/java/org/onap/so/TestApplication.java | 35 ---- .../onap/so/db/request/OperationStatusTest.java | 82 --------- .../OperationalEnvServiceModelStatusTest.java | 80 --------- .../org/onap/so/db/request/RequestDBConfig.java | 77 --------- .../org/onap/so/db/request/SiteStatusTest.java | 86 ---------- .../InfraActiveRequestsRepositoryImplTest.java | 184 --------------------- 7 files changed, 578 deletions(-) delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java (limited to 'mso-api-handlers/mso-requests-db/src/test/java') diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java deleted file mode 100644 index 5a8df1d556..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public abstract class BaseTest { - -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java deleted file mode 100644 index 00d212a23e..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Profile; - -@SpringBootApplication(scanBasePackages = { "org.onap.so.db" }) -@Profile("test") -public class TestApplication { - public static void main(String... args) { - SpringApplication.run(TestApplication.class, args); - System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("server.name", "Springboot"); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java deleted file mode 100644 index a10d948b8f..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so.db.request; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.Date; - -import javax.transaction.Transactional; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.TestApplication; -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.OperationStatusId; -import org.onap.so.db.request.data.repository.OperationStatusRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class OperationStatusTest { - - @Autowired - private OperationStatusRepository repository; - - @Test - @Transactional - public void timeStampCreated() throws InterruptedException { - - final String testServiceId = "test-service-id"; - final String testOperationId = "test-operation-id"; - final OperationStatusId id = new OperationStatusId(testServiceId, testOperationId); - OperationStatus status = new OperationStatus(); - - status.setServiceId(testServiceId); - status.setOperationId(testOperationId); - - status = repository.saveAndFlush(status); - - OperationStatus found = repository.findOne(id); - - Date operateAt = found.getOperateAt(); - assertNotNull(operateAt); - assertEquals(testServiceId, found.getServiceId()); - Date finishedAt = found.getFinishedAt(); - status.setProgress("test-progress"); - //timestamps only set to save on 1 second changes - Thread.sleep(1000); - repository.saveAndFlush(status); - - OperationStatus foundUpdate = repository.findOne(id); - - assertEquals(operateAt.toString(), foundUpdate.getOperateAt().toString()); - assertNotNull(foundUpdate.getFinishedAt()); - assertNotEquals(finishedAt.toString(), foundUpdate.getFinishedAt().toString()); - assertEquals("test-progress", foundUpdate.getProgress()); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java deleted file mode 100644 index c12d3cbb7b..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so.db.request; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.TestApplication; -import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.ExampleMatcher; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class OperationalEnvServiceModelStatusTest { - - @Autowired - private OperationalEnvServiceModelStatusRepository repository; - - - @Test - public void updateWithoutAllKeys() throws Exception { - - OperationalEnvServiceModelStatus status = new OperationalEnvServiceModelStatus(); - status.setRequestId("request-id-1"); - status.setOperationalEnvId("oper-env-id-1"); - status.setServiceModelVersionId("service-model-ver-id-1"); - status.setRetryCount(0); - - repository.saveAndFlush(status); - OperationalEnvServiceModelStatus status2 = repository.findOneByOperationalEnvIdAndServiceModelVersionId("oper-env-id-1", "service-model-ver-id-1"); - status2.setRetryCount(1); - - repository.saveAndFlush(status2); - - OperationalEnvServiceModelStatus status3 = new OperationalEnvServiceModelStatus(); - - status3.setRequestId("request-id-2"); - status3.setOperationalEnvId("oper-env-id-1"); - status3.setServiceModelVersionId("service-model-ver-id-2"); - status3.setRetryCount(2); - - repository.saveAndFlush(status3); - - OperationalEnvServiceModelStatus exampleObj = new OperationalEnvServiceModelStatus(); - exampleObj.setOperationalEnvId("oper-env-id-1"); - exampleObj.setServiceModelVersionId("service-model-ver-id-1"); - ExampleMatcher matcher = ExampleMatcher.matching().withIgnorePaths("requestId"); - OperationalEnvServiceModelStatus foundStatus = repository.findOne(Example.of(exampleObj,matcher)); - if(foundStatus== null) - throw new Exception("No status found"); - - assertEquals(new Integer(1), foundStatus.getRetryCount()); - } -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java deleted file mode 100644 index 9bcff13699..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so.db.request; - - -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@EnableTransactionManagement -@EnableJpaRepositories( - entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager", - basePackages = { "org.onap.so.db.request.data.repository" } - ) -public class RequestDBConfig { - - @Primary - @Bean(name = "requestDataSource") - @ConfigurationProperties(prefix = "spring.datasource") - public DataSource dataSource() { - return DataSourceBuilder.create().build(); - } - - @Primary - @Bean(name = "requestEntityManagerFactory") - public LocalContainerEntityManagerFactoryBean - entityManagerFactory( - EntityManagerFactoryBuilder builder, - @Qualifier("requestDataSource") DataSource dataSource - ) { - return builder - .dataSource(dataSource) - .packages("org.onap.so.db.request.beans") - .persistenceUnit("requestDB") - .build(); - } - - @Primary - @Bean(name = "requestTransactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("requestEntityManagerFactory") EntityManagerFactory - entityManagerFactory - ) { - return new JpaTransactionManager(entityManagerFactory); - } - -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java deleted file mode 100644 index 917f52d4ad..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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========================================================= - */ - -package org.onap.so.db.request; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import javax.transaction.Transactional; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.TestApplication; -import org.onap.so.db.request.beans.SiteStatus; -import org.onap.so.db.request.data.repository.SiteStatusRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageRequest; -import org.springframework.data.domain.Sort.Direction; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class SiteStatusTest { - - @Autowired - private SiteStatusRepository repository; - - @Test - @Transactional - public void timeStampCreated() throws InterruptedException { - SiteStatus found = repository.findOne("test name4"); - assertNotNull(found.getCreated()); - assertEquals("test name4", found.getSiteName()); - } - - @Test - public void sortByCreated() { - - final PageRequest page1 = new PageRequest( - 0, 20, Direction.DESC, "created" - ); - - SiteStatus example = new SiteStatus(); - example.setStatus(true); - Page found = repository.findAll(Example.of(example), page1); - - assertEquals("test name4", found.getContent().get(0).getSiteName()); - - } - - @Test - public void updateStatus() { - - SiteStatus status = repository.findOne("test name update"); - status.setStatus(false); - - repository.saveAndFlush(status); - - assertEquals(false, repository.findOne("test name update").getStatus()); - - } - -} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java deleted file mode 100644 index d889a15fc4..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.db.request.data.repository; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; -import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION; -import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID; -import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.TestApplication; -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class InfraActiveRequestsRepositoryImplTest { - - private static final int MAX_LIMIT = 1; - private static final long END_TIME_IN_MILISEC = 1482436800000l; - private static final long START_TIME_IN_MILISEC = 1482429600000l; - private static final String REQUEST_ID_VALUE = "00032ab7-3fb3-42e5-965d-8ea592502017"; - private static final String SERVICE_INSTANCE_ID_VALUE = "e3b5744d-2ad1-4cdd-8390-c999a38829bc"; - - @Autowired - private InfraActiveRequestsRepository objUnderTest; - - @Test - public void test_GetInfraActiveRequests_emptyFiltersMap() { - final List actualRequests = objUnderTest.getInfraActiveRequests(Collections.emptyMap(), - START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); - assertFalse(actualRequests.isEmpty()); - } - - @Test - public void test_GetInfraActiveRequests_invalidFiltersMap() { - final Map filters = new HashMap<>(); - filters.put("OverTheMoon", new String[] {"Humpty Dumpty Sat On The Wall"}); - final long startTime = START_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20); - final long endTime = END_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20); - final List actualRequests = - objUnderTest.getInfraActiveRequests(filters, startTime, endTime, null); - assertTrue(actualRequests.isEmpty()); - } - - @Test - public void test_GetInfraActiveRequests_invalidFiltersMapWithInvalidKey() { - final Map filters = new HashMap<>(); - filters.put("OverTheMoon", new String[] {"Avengers", "Humpty Dumpty Sat On The Wall"}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(filters, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); - assertFalse(actualRequests.isEmpty()); - } - - @Test - public void test_GetInfraActiveRequestsData_withEqualServiceInstanceId() { - final Map values = new HashMap<>(); - values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); - assertFalse(actualRequests.isEmpty()); - - assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); - } - - - @Test - public void test_GetInfraActiveRequestsData_withLikeRequestID() { - final Map values = new HashMap<>(); - values.put(REQUEST_ID, new String[] {QueryOperationType.LIKE.name(), "00032ab7"}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); - assertFalse(actualRequests.isEmpty()); - - assertEquals(REQUEST_ID_VALUE, actualRequests.get(0).getRequestId()); - assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); - } - - - @Test - public void test_GetInfraActiveRequestsData_withLikeRequestIDAndEqualToServiceInstanceId() { - final Map values = new HashMap<>(); - values.put(REQUEST_ID, new String[] {QueryOperationType.LIKE.name(), "00032ab7"}); - values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); - assertFalse(actualRequests.isEmpty()); - - assertEquals(REQUEST_ID_VALUE, actualRequests.get(0).getRequestId()); - assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); - } - - - @Test - public void test_GetInfraActiveRequestsData_withNotEqualAction() { - final Map values = new HashMap<>(); - values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); - assertFalse(actualRequests.isEmpty()); - for (final InfraActiveRequests actualActiveRequests : actualRequests) { - assertNotEquals("createInstance", actualActiveRequests.getAction()); - } - } - - - @Test - public void test_GetInfraActiveRequestsData_withNotEqualToServiceInstanceNameAndServiceInstanceIdNul() { - final Map values = new HashMap<>(); - values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); - values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); - - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); - assertFalse(actualRequests.isEmpty()); - for (final InfraActiveRequests actualActiveRequests : actualRequests) { - assertNotEquals("createInstance", actualActiveRequests.getAction()); - assertEquals(SERVICE_INSTANCE_ID_VALUE, actualActiveRequests.getServiceInstanceId()); - } - } - - @Test - public void test_GetInfraActiveRequestsData_withStartEndDateTimeNotEqualAction() { - final Map values = new HashMap<>(); - values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); - assertFalse(actualRequests.isEmpty()); - for (final InfraActiveRequests actualActiveRequests : actualRequests) { - assertNotEquals("createInstance", actualActiveRequests.getAction()); - } - } - - @Test - public void test_GetInfraActiveRequestsData_withLimitNotEqualAction() { - final Map values = new HashMap<>(); - values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); - final List actualRequests = - objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); - assertFalse(actualRequests.isEmpty()); - for (final InfraActiveRequests actualActiveRequests : actualRequests) { - assertNotEquals("createInstance", actualActiveRequests.getAction()); - } - } - - @Test - public void test_GetInfraActiveRequestsData_withNullFilters() { - final List actualRequests = - objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); - assertTrue(actualRequests.isEmpty()); - } -} -- cgit 1.2.3-korg