Search in sources :

Example 1 with CloudifyManager

use of org.onap.so.db.catalog.beans.CloudifyManager in project so by onap.

the class CloudifyManagerTest method cloneTest.

@Test
public void cloneTest() {
    cloudifyManager.setId(ID);
    cloudifyManager.setCloudifyUrl(CLOUDIFY_URL);
    cloudifyManager.setUsername(USERNAME);
    cloudifyManager.setPassword(PASSWORD);
    cloudifyManager.setVersion(VERSION);
    CloudifyManager clone = cloudifyManager.clone();
    assertEquals(cloudifyManager, clone);
}
Also used : CloudifyManager(org.onap.so.db.catalog.beans.CloudifyManager) Test(org.junit.Test)

Example 2 with CloudifyManager

use of org.onap.so.db.catalog.beans.CloudifyManager in project so by onap.

the class R__CloudConfigMigration method migrateCloudifyManagers.

private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws SQLException {
    String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" + " VALUES (?,?,?,?,?,?);";
    try (Statement stmt = connection.createStatement();
        PreparedStatement ps = connection.prepareStatement(insert)) {
        for (CloudifyManager cloudifyManager : entities) {
            try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) {
                int count = 0;
                while (rows.next()) {
                    count = rows.getInt(1);
                }
                if (count == 0) {
                    ps.setString(1, cloudifyManager.getId());
                    ps.setString(2, cloudifyManager.getCloudifyUrl());
                    ps.setString(3, cloudifyManager.getUsername());
                    ps.setString(4, cloudifyManager.getPassword());
                    ps.setString(5, cloudifyManager.getVersion());
                    ps.setString(6, FLYWAY);
                    ps.executeUpdate();
                }
            }
        }
    }
}
Also used : CloudifyManager(org.onap.so.db.catalog.beans.CloudifyManager) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 3 with CloudifyManager

use of org.onap.so.db.catalog.beans.CloudifyManager in project so by onap.

the class CatalogDbClientTest method testGetCloudifyManagerHappyPath.

@Test
public void testGetCloudifyManagerHappyPath() throws Exception {
    CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
    assertNotNull(cloudifyManager);
    assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
}
Also used : CloudifyManager(org.onap.so.db.catalog.beans.CloudifyManager) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 4 with CloudifyManager

use of org.onap.so.db.catalog.beans.CloudifyManager in project so by onap.

the class CatalogDbClientTest method testGetCloudifyManagerNotFound.

@Test
public void testGetCloudifyManagerNotFound() throws Exception {
    CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
    assertNull(cloudifyManager);
}
Also used : CloudifyManager(org.onap.so.db.catalog.beans.CloudifyManager) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 5 with CloudifyManager

use of org.onap.so.db.catalog.beans.CloudifyManager in project so by onap.

the class CloudifyManagerRepositoryTest method findOneTest.

@Test
public void findOneTest() throws Exception {
    CloudifyManager cloudifyManager = cloudifyManagerRepository.findById("mtn13").orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
    Assert.assertNotNull(cloudifyManager);
    Assert.assertEquals("mtn13", cloudifyManager.getId());
}
Also used : CloudifyManager(org.onap.so.db.catalog.beans.CloudifyManager) NoEntityFoundException(org.onap.so.db.catalog.exceptions.NoEntityFoundException) BaseTest(org.onap.so.db.catalog.BaseTest) Test(org.junit.Test)

Aggregations

CloudifyManager (org.onap.so.db.catalog.beans.CloudifyManager)5 Test (org.junit.Test)4 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)2 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Statement (java.sql.Statement)1 BaseTest (org.onap.so.db.catalog.BaseTest)1 NoEntityFoundException (org.onap.so.db.catalog.exceptions.NoEntityFoundException)1