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);
}
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();
}
}
}
}
}
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());
}
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);
}
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());
}
Aggregations