diff options
author | Shadi Haidar <sh1986@att.com> | 2018-09-14 17:22:14 -0400 |
---|---|---|
committer | Shadi Haidar <sh1986@att.com> | 2018-09-14 17:23:12 -0400 |
commit | f8426d18257c33fa8a0267e4f96f7e53bb4a82ee (patch) | |
tree | 78aee264bca03560e43e03ccd2e65dabfef8b44c /src/test/java/org/onap/dcae/inventory/daos | |
parent | 4a81073bb3ce0e873bcf38853e66f8ae4150da67 (diff) |
Address warnings
Change-Id: I953b71d130c78bb20cf602e101021e29b538088e
Issue-ID: DCAEGEN2-605
Signed-off-by: Shadi Haidar <sh1986@att.com>
Diffstat (limited to 'src/test/java/org/onap/dcae/inventory/daos')
-rw-r--r-- | src/test/java/org/onap/dcae/inventory/daos/DCAEServicesDAOTest.java | 32 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/inventory/daos/InventoryDAOManagerTests.java | 8 |
2 files changed, 21 insertions, 19 deletions
diff --git a/src/test/java/org/onap/dcae/inventory/daos/DCAEServicesDAOTest.java b/src/test/java/org/onap/dcae/inventory/daos/DCAEServicesDAOTest.java index af05704..cdafc4d 100644 --- a/src/test/java/org/onap/dcae/inventory/daos/DCAEServicesDAOTest.java +++ b/src/test/java/org/onap/dcae/inventory/daos/DCAEServicesDAOTest.java @@ -20,32 +20,32 @@ package org.onap.dcae.inventory.daos; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import org.junit.Before; +import org.junit.Test; +import org.onap.dcae.inventory.dbthings.models.DCAEServiceObject; +import org.skife.jdbi.v2.DBI; + import com.codahale.metrics.MetricRegistry; + import io.dropwizard.db.DataSourceFactory; import io.dropwizard.jackson.Jackson; import io.dropwizard.jdbi.DBIFactory; import io.dropwizard.setup.Environment; import io.swagger.model.DCAEServiceRequest; -import org.junit.Before; -import org.junit.Test; -import org.onap.dcae.inventory.dbthings.models.DCAEServiceObject; -import org.skife.jdbi.v2.DBI; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; /** * Created by mhwang on 3/25/18. */ public class DCAEServicesDAOTest { - private DCAEServicesDAO fooDAO; + private DCAEServicesDAO fooDao; // Learned about the H2 approach from here: // https://stackoverflow.com/questions/35825383/how-to-test-jdbi-daos-with-h2-in-memory-database - protected DataSourceFactory getDataSourceFactory() - { + protected DataSourceFactory getDataSourceFactory() { DataSourceFactory dataSourceFactory = new DataSourceFactory(); dataSourceFactory.setDriverClass( "org.h2.Driver" ); dataSourceFactory.setUrl( "jdbc:h2:mem:testDb" ); @@ -59,13 +59,13 @@ public class DCAEServicesDAOTest { public void setUp() { Environment env = new Environment( "test-env", Jackson.newObjectMapper(), null, new MetricRegistry(), null ); DBI dbi = new DBIFactory().build( env, getDataSourceFactory(), "test" ); - fooDAO = dbi.onDemand(DCAEServicesDAO.class); + fooDao = dbi.onDemand(DCAEServicesDAO.class); } @Test public void testSaveAndGet() { try { - fooDAO.createTable(); + fooDao.createTable(); DCAEServiceRequest request = new DCAEServiceRequest(); request.setTypeId("some-type-id"); request.setVnfId("some-vnf-id"); @@ -73,11 +73,11 @@ public class DCAEServicesDAOTest { request.setVnfLocation("some-vnf-location"); request.setDeploymentRef("some-deployment-ref"); DCAEServiceObject so = new DCAEServiceObject("some-service-id", request); - fooDAO.insert(so); + fooDao.insert(so); - DCAEServiceObject target = fooDAO.getByServiceId("some-service-id"); + DCAEServiceObject target = fooDao.getByServiceId("some-service-id"); assertEquals(target.getServiceId(), so.getServiceId()); - } catch(Exception e) { + } catch (Exception e) { fail("Failure at some point in this compound test."); } } diff --git a/src/test/java/org/onap/dcae/inventory/daos/InventoryDAOManagerTests.java b/src/test/java/org/onap/dcae/inventory/daos/InventoryDAOManagerTests.java index 8346372..50bb373 100644 --- a/src/test/java/org/onap/dcae/inventory/daos/InventoryDAOManagerTests.java +++ b/src/test/java/org/onap/dcae/inventory/daos/InventoryDAOManagerTests.java @@ -20,17 +20,19 @@ package org.onap.dcae.inventory.daos; +import static org.mockito.Mockito.mock; + +import org.junit.Test; import org.onap.dcae.inventory.InventoryConfiguration; + import io.dropwizard.setup.Environment; -import org.junit.Test; -import static org.mockito.Mockito.mock; /** * Created by mhwang on 3/8/17. */ public class InventoryDAOManagerTests { - @Test(expected=InventoryDAOManager.InventoryDAOManagerSetupException.class) + @Test(expected = InventoryDAOManager.InventoryDAOManagerSetupException.class) public void testInitializeStrictness() { InventoryDAOManager daoManager = InventoryDAOManager.getInstance(); Environment environment = mock(Environment.class); |