Skip to content
Snippets Groups Projects
Commit d2601d10 authored by Nikolaos Kyriakoulis's avatar Nikolaos Kyriakoulis
Browse files

Identifying errors that caused a broken pipeline

parent 11742966
No related branches found
No related tags found
2 merge requests!36Merging 2024Q2_RC into main, creating 2024Q2 Release,!18Resolve "Increase test coverage in TMF638"
Pipeline #5279 failed
......@@ -202,24 +202,61 @@ public class ServiceRepoServiceTest {
// // org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection [HikariPool-1 - Connection is not available, request timed out after 30000ms.]
// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"})
// @Test
// public void testNfvCatalogNSResourceChanged() throws Exception {
// String response = createService();
// Service responsesService = JsonUtils.toJsonObj(response, Service.class);
// String id = responsesService.getId();
//
// DeploymentDescriptor dd = new DeploymentDescriptor();
// dd.setId(1234567890);
//
// serviceRepoService.nfvCatalogNSResourceChanged(dd);
//
// Service updatedService = serviceRepoService.findByUuid(id);
// Set<Note> noteList = updatedService.getNote();
//
// boolean expectedNoteExists = false;
// for (Note n : noteList) {
// if ( n.getText().equals("NS Resource LCM Changed") && n.getAuthor().equals("SIM638-API")) {
// expectedNoteExists= true;
// break;
// }
// }
// assertThat( expectedNoteExists ).isTrue();
// }
// // org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection [HikariPool-1 - Connection is not available, request timed out after 30000ms.]
@WithMockUser(username="osadmin", roles = {"ADMIN","USER"})
@Test
public void testNfvCatalogNSResourceChanged() throws Exception {
public void testResourceStateChangedEvent() throws Exception {
String response = createService();
Service responsesService = JsonUtils.toJsonObj(response, Service.class);
String id = responsesService.getId();
Set<ResourceRef> resourceRefSet = responsesService.getSupportingResource();
List<ResourceRef> resourceRefList = new ArrayList<>(resourceRefSet);
assertThat(resourceRefList.size()).isEqualTo(1);
ResourceRef firstResourceRef = resourceRefList.get(0);
DeploymentDescriptor dd = new DeploymentDescriptor();
dd.setId(1234567890);
Resource resource = resourceRepoService.findByUuid(firstResourceRef.getId());
serviceRepoService.nfvCatalogNSResourceChanged(dd);
ResourceStateChangeNotification resourceCreateNotification = new ResourceStateChangeNotification();
ResourceStateChangeEvent event = new ResourceStateChangeEvent();
event.getEvent().setResource(resource);
resourceCreateNotification.setEvent(event);
serviceRepoService.resourceStateChangedEvent(resourceCreateNotification);
Service updatedService = serviceRepoService.findByUuid(id);
Set<Note> noteList = updatedService.getNote();
Set<Note> noteSet = updatedService.getNote();
List<Note> noteList = new ArrayList<>(noteSet);
boolean expectedNoteExists = false;
for (Note n : noteList) {
if ( n.getText().equals("NS Resource LCM Changed") && n.getAuthor().equals("SIM638-API")) {
if ( n.getText().contains("State Changed with status:") && n.getAuthor().equals("SIM638-API")) {
expectedNoteExists= true;
break;
}
......@@ -228,43 +265,6 @@ public class ServiceRepoServiceTest {
}
// // org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection [HikariPool-1 - Connection is not available, request timed out after 30000ms.]
//// @WithMockUser(username="osadmin", roles = {"ADMIN","USER"})
//// @Test
//// public void testResourceStateChangedEvent() throws Exception {
//// String response = createService();
//// Service responsesService = JsonUtils.toJsonObj(response, Service.class);
//// String id = responsesService.getId();
//// Set<ResourceRef> resourceRefSet = responsesService.getSupportingResource();
//// List<ResourceRef> resourceRefList = new ArrayList<>(resourceRefSet);
////
//// assertThat(resourceRefList.size()).isEqualTo(1);
//// ResourceRef firstResourceRef = resourceRefList.get(0);
////
//// Resource resource = resourceRepoService.findByUuid(firstResourceRef.getId());
////
//// ResourceStateChangeNotification resourceCreateNotification = new ResourceStateChangeNotification();
//// ResourceStateChangeEvent event = new ResourceStateChangeEvent();
//// event.getEvent().setResource(resource);
//// resourceCreateNotification.setEvent(event);
////
//// serviceRepoService.resourceStateChangedEvent(resourceCreateNotification);
//// Service updatedService = serviceRepoService.findByUuid(id);
////
//// Set<Note> noteSet = updatedService.getNote();
//// List<Note> noteList = new ArrayList<>(noteSet);
////
//// boolean expectedNoteExists = false;
//// for (Note n : noteList) {
//// if ( n.getText().contains("State Changed with status:") && n.getAuthor().equals("SIM638-API")) {
//// expectedNoteExists= true;
//// break;
//// }
//// }
//// assertThat( expectedNoteExists ).isTrue();
//// }
//
//
private String createService() throws Exception {
int servicesCount = serviceRepoService.findAll().size();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment