public void handleDmaapMsg(String msg) {
this.createTask(msg) //
.subscribe(message -> logger.debug("handleDmaapMsg: {}", message), //
- throwable -> logger.warn("handleDmaapMsg failure ", throwable), //
+ throwable -> logger.warn("handleDmaapMsg failure {}", throwable.getMessage()), //
() -> logger.debug("handleDmaapMsg complete"));
}
logger.debug("Starting refreshConfigTask");
stop();
refreshTask = createRefreshTask() //
- .subscribe(notUsed -> logger.debug("Refreshed configuration data"),
- throwable -> logger.error("Configuration refresh terminated due to exception", throwable),
+ .subscribe(
+ notUsed -> logger.debug("Refreshed configuration data"), throwable -> logger
+ .error("Configuration refresh terminated due to exception {}", throwable.getMessage()),
() -> logger.error("Configuration refresh terminated"));
}
createNotificationClient(url) //
.put("", body) //
.subscribe( //
- notUsed -> logger.debug("Service {} notified", service.getName()), throwable -> logger
- .warn("Service notification failed for service: {}", service.getName(), throwable),
+ notUsed -> logger.debug("Service {} notified", service.getName()),
+ throwable -> logger.warn("Service notification failed for service: {}. Cause: {}",
+ service.getName(), throwable.getMessage()),
() -> logger.debug("All services notified"));
}
}
}
private Mono<String> handleDeleteFromRicFailure(Policy policy, Throwable e) {
- logger.warn("Could not delete policy: {} from ric: {}", policy.id(), policy.ric().name(), e);
+ logger.warn("Could not delete policy: {} from ric: {}. Cause: {}", policy.id(), policy.ric().name(),
+ e.getMessage());
return Mono.empty();
}
}
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Properties;
import java.util.Vector;
-
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.oransc.policyagent.repository.Rics;
import org.oransc.policyagent.repository.Services;
import org.oransc.policyagent.utils.LoggingUtils;
-
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;
refreshTaskUnderTest.start();
ILoggingEvent event = logAppender.list.get(0);
- assertThat(event.getThrowableProxy().getMessage()).isEqualTo("Error");
+ assertThat(event.getLevel()).isEqualTo(ERROR);
assertThat(event.toString().contains("Configuration refresh terminated due to exception")).isTrue();
}
synchronizerUnderTest.run(RIC_1);
ILoggingEvent loggingEvent = logAppender.list.get(0);
- assertThat(loggingEvent.getThrowableProxy().getMessage()).isEqualTo(originalErrorMessage);
+ assertThat(loggingEvent.getLevel()).isEqualTo(WARN);
verifyCorrectLogMessage(0, logAppender, "Service notification failed for service: " + SERVICE_1_NAME);
}
assertThat(services.size()).isEqualTo(0);
ILoggingEvent loggingEvent = logAppender.list.get(0);
- assertThat(loggingEvent.getThrowableProxy().getMessage()).isEqualTo(originalErrorMessage);
- String expectedLogMessage = "Could not delete policy: " + POLICY_ID + " from ric: " + RIC_NAME;
+ assertThat(loggingEvent.getLevel()).isEqualTo(WARN);
+ String expectedLogMessage =
+ "Could not delete policy: " + POLICY_ID + " from ric: " + RIC_NAME + ". Cause: " + originalErrorMessage;
assertThat(loggingEvent.toString().contains(expectedLogMessage)).isTrue();
}