Removed the "preprocessed" flag from the Actor parameter class, now
that the actors no longer have a startPreprocess() method.
Also removed targetEntity from Actor parameter class. Created a
makeOutcome method within OperationPartial, which is used to create an
initial outcome whose target field is pre-populated with the
target-entity extracted from the properties. As the meaning of "target"
may be specific to an operation, the makeOutcome method may be
overridden by an operation subclass.
Issue-ID: POLICY-2804
Change-Id: Ifb66de63301d644e69340009593513773ee5672d
Signed-off-by: Jim Hahn <jrh3@att.com>
21 files changed:
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
StringBuilder str = new StringBuilder(getClient().getBaseUrl());
- String path = getPath() + URI_SEP + URLEncoder.encode(getTargetEntity(), StandardCharsets.UTF_8);
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+ String path = getPath() + URI_SEP + URLEncoder.encode(target, StandardCharsets.UTF_8);
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
+import org.onap.policy.controlloop.actorserviceprovider.OperationProperties;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
WebTarget web = getClient().getWebTarget().path(path);
str.append(path);
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+
web = addQuery(web, str, "?", "search-node-type", "vserver");
web = addQuery(web, str, "?", "search-node-type", "vserver");
- web = addQuery(web, str, "&", "filter", "vserver-name:EQUALS:" + getTargetEntity());
+ web = addQuery(web, str, "&", "filter", "vserver-name:EQUALS:" + target);
Builder webldr = web.request();
addHeaders(webldr, headers);
Builder webldr = web.request();
addHeaders(webldr, headers);
HttpParams opParams = HttpParams.builder().clientName(MY_CLIENT).path("v16/query").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
HttpParams opParams = HttpParams.builder().clientName(MY_CLIENT).path("v16/query").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new AaiCustomQueryOperation(params, config);
oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK);
oper = new AaiCustomQueryOperation(params, config);
oper.setProperty(OperationProperties.AAI_VSERVER_LINK, MY_LINK);
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetPnfOperation(params, config);
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetPnfOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetTenantOperation(params, config);
public void setUp() throws Exception {
super.setUpBasic();
oper = new AaiGetTenantOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
BidirectionalTopicParams.builder().sinkTopic(MY_SINK).sourceTopic(MY_SINK).build();
config = new BidirectionalTopicConfig(blockingExecutor, opParams, topicMgr, AppcOperation.SELECTOR_KEYS);
BidirectionalTopicParams.builder().sinkTopic(MY_SINK).sourceTopic(MY_SINK).build();
config = new BidirectionalTopicConfig(blockingExecutor, opParams, topicMgr, AppcOperation.SELECTOR_KEYS);
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new ModifyConfigOperation(params, config);
oper = new ModifyConfigOperation(params, config);
* Action Identifiers are required for APPC LCM requests. For R1, the recipes
* supported by Policy only require a vnf-id.
*/
* Action Identifiers are required for APPC LCM requests. For R1, the recipes
* supported by Policy only require a vnf-id.
*/
- inputRequest.setActionIdentifiers(Map.of(VNF_ID_KEY, getTargetEntity()));
+ String target = getProperty(OperationProperties.AAI_TARGET_ENTITY);
+ inputRequest.setActionIdentifiers(Map.of(VNF_ID_KEY, target));
/*
* For R1, the payloads will not be required for the Restart, Rebuild, or Migrate
/*
* For R1, the payloads will not be required for the Restart, Rebuild, or Migrate
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
response = makeResponse();
oper = new AppcLcmOperation(params, config);
response = makeResponse();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new AppcLcmOperation(params, config);
params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
outcome = oper.start().get();
assertEquals(OperationResult.SUCCESS, outcome.getResult());
outcome = oper.start().get();
assertEquals(OperationResult.SUCCESS, outcome.getResult());
// only builds a payload for ConfigModify
params = params.toBuilder().operation(AppcLcmConstants.OPERATION_CONFIG_MODIFY).build();
oper = new AppcLcmOperation(params, config);
// only builds a payload for ConfigModify
params = params.toBuilder().operation(AppcLcmConstants.OPERATION_CONFIG_MODIFY).build();
oper = new AppcLcmOperation(params, config);
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, TARGET_ENTITY);
oper.generateSubRequestId(2);
AppcLcmDmaapWrapper req = oper.makeRequest(2);
oper.generateSubRequestId(2);
AppcLcmDmaapWrapper req = oper.makeRequest(2);
oper.generateSubRequestId(2);
oper.generateSubRequestId(2);
- assertThatIllegalArgumentException().isThrownBy(() -> oper.makeRequest(2))
- .withMessage("Cannot convert payload");
+ assertThatThrownBy(() -> oper.makeRequest(2)).isInstanceOf(NullPointerException.class);
import org.onap.policy.simulators.Util;
public class GrpcOperationTest {
import org.onap.policy.simulators.Util;
public class GrpcOperationTest {
- private static final String TARGET_ENTITY = "entity";
private static final String MY_VNF = "my-vnf";
private static final String MY_SVC_ID = "my-service-instance-id";
private static final String RESOURCE_ID = "my-resource-id";
private static final String MY_VNF = "my-vnf";
private static final String MY_SVC_ID = "my-service-instance-id";
private static final String RESOURCE_ID = "my-resource-id";
targetEntityIds.put(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID);
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation(GrpcOperation.NAME)
targetEntityIds.put(ControlLoopOperationParams.PARAMS_ENTITY_RESOURCEID, RESOURCE_ID);
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation(GrpcOperation.NAME)
- .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY)
+ .requestId(REQUEST_ID).actorService(new ActorService())
Map<String, Object> payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0");
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe")
Map<String, Object> payload = Map.of("artifact_name", "my_artifact", "artifact_version", "1.0");
params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR).operation("subscribe")
- .requestId(REQUEST_ID).actorService(new ActorService()).targetEntity(TARGET_ENTITY)
+ .requestId(REQUEST_ID).actorService(new ActorService())
.retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload)
.retry(0).timeoutSec(5).executor(blockingExecutor).payload(payload)
- .preprocessed(true).build();
cdsProps.setHost("localhost");
cdsProps.setPort(sim.getPort());
cdsProps.setHost("localhost");
cdsProps.setPort(sim.getPort());
ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR)
.operation(GrpcOperation.NAME).requestId(REQUEST_ID).actorService(new ActorService())
ControlLoopOperationParams params = ControlLoopOperationParams.builder().actor(CdsActorConstants.CDS_ACTOR)
.operation(GrpcOperation.NAME).requestId(REQUEST_ID).actorService(new ActorService())
- .targetType(targetType).targetEntity(TARGET_ENTITY).payload(payloadMap).build();
+ .targetType(targetType).payload(payloadMap).build();
GrpcConfig config = new GrpcConfig(executor, cdsProps);
operation = new GrpcOperation(params, config);
GrpcConfig config = new GrpcConfig(executor, cdsProps);
operation = new GrpcOperation(params, config);
final Executor executor = params.getExecutor();
final CallbackManager callbacks = new CallbackManager();
final Executor executor = params.getExecutor();
final CallbackManager callbacks = new CallbackManager();
- return CompletableFuture.completedFuture(params.makeOutcome(getTargetEntity()))
+ return CompletableFuture.completedFuture(makeOutcome())
.whenCompleteAsync(callbackStarted(callbacks), executor)
.whenCompleteAsync(callbackCompleted(callbacks), executor);
}
.whenCompleteAsync(callbackStarted(callbacks), executor)
.whenCompleteAsync(callbackCompleted(callbacks), executor);
}
.path("GENERIC-RESOURCE-API:vf-module-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
.path("GENERIC-RESOURCE-API:vf-module-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new BandwidthOnDemandOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
oper = new BandwidthOnDemandOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
.path("GENERIC-RESOURCE-API:network-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
.path("GENERIC-RESOURCE-API:network-topology-operation").build();
config = new HttpConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new RerouteOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
oper = new RerouteOperation(params, config);
oper.setProperty(OperationProperties.ENRICHMENT_SERVICE_ID, MY_SERVICE);
.maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
.maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new VfModuleCreate(params, config);
oper = new VfModuleCreate(params, config);
.pollPath("orchestrationRequests/v5/").maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
.pollPath("orchestrationRequests/v5/").maxPolls(2).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
oper = new VfModuleDelete(params, config);
oper = new VfModuleDelete(params, config);
*/
protected void makeContext() {
params = ControlLoopOperationParams.builder().executor(executor).requestId(REQ_ID).actorService(service)
*/
protected void makeContext() {
params = ControlLoopOperationParams.builder().executor(executor).requestId(REQ_ID).actorService(service)
- .actor(actorName).operation(operationName).targetEntity(TARGET_ENTITY).payload(makePayload())
+ .actor(actorName).operation(operationName).payload(makePayload())
assertEquals(ACTOR, oper.params.getActor());
assertEquals(OPERATION, oper.params.getOperation());
assertSame(BasicHttpOperation.REQ_ID, oper.params.getRequestId());
assertEquals(ACTOR, oper.params.getActor());
assertEquals(OPERATION, oper.params.getOperation());
assertSame(BasicHttpOperation.REQ_ID, oper.params.getRequestId());
- assertEquals(BasicHttpOperation.TARGET_ENTITY, oper.params.getTargetEntity());
.maxPolls(1).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
.maxPolls(1).build();
config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory());
- params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build();
+ params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build();
restartOper = new Restart(params, config);
restartOper = new Restart(params, config);
logger.info("{}: start operation attempt {} for {}", getFullName(), attempt, params.getRequestId());
final Executor executor = params.getExecutor();
logger.info("{}: start operation attempt {} for {}", getFullName(), attempt, params.getRequestId());
final Executor executor = params.getExecutor();
- final OperationOutcome outcome = params.makeOutcome(getTargetEntity());
+ final OperationOutcome outcome = makeOutcome();
final CallbackManager callbacks = new CallbackManager();
// this operation attempt gets its own controller
final CallbackManager callbacks = new CallbackManager();
// this operation attempt gets its own controller
outcome = origOutcome;
} else {
logger.warn("{}: null outcome; treating as a failure for {}", getFullName(), params.getRequestId());
outcome = origOutcome;
} else {
logger.warn("{}: null outcome; treating as a failure for {}", getFullName(), params.getRequestId());
- outcome = this.setOutcome(params.makeOutcome(getTargetEntity()), OperationResult.FAILURE);
+ outcome = this.setOutcome(makeOutcome(), OperationResult.FAILURE);
}
// ensure correct actor/operation
}
// ensure correct actor/operation
private Function<Throwable, OperationOutcome> fromException(String type) {
return thrown -> {
private Function<Throwable, OperationOutcome> fromException(String type) {
return thrown -> {
- OperationOutcome outcome = params.makeOutcome(getTargetEntity());
+ OperationOutcome outcome = makeOutcome();
if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
// do not include exception in the message, as it just clutters the log
if (thrown instanceof CancellationException || thrown.getCause() instanceof CancellationException) {
// do not include exception in the message, as it just clutters the log
+ /**
+ * Makes an outcome, populating the "target" field with the contents of the target
+ * entity property.
+ *
+ * @return a new operation outcome
+ */
+ protected OperationOutcome makeOutcome() {
+ return params.makeOutcome(getProperty(OperationProperties.AAI_TARGET_ENTITY));
+ }
+
/**
* Determines if a throwable is due to a timeout.
*
/**
* Determines if a throwable is due to a timeout.
*
return DEFAULT_RETRY_WAIT_MS;
}
return DEFAULT_RETRY_WAIT_MS;
}
- /**
- * Gets the target entity, first trying the properties and then the parameters.
- *
- * @return the target entity
- */
- protected String getTargetEntity() {
- String targetEntity = getProperty(OperationProperties.AAI_TARGET_ENTITY);
- return (targetEntity != null ? targetEntity : params.getTargetEntity());
- }
-
/**
* Gets the operation timeout.
*
/**
* Gets the operation timeout.
*
*/
private Map<String, Object> payload;
*/
private Map<String, Object> payload;
- /**
- * {@code True} if the preprocessing steps have already been executed, {@code false}
- * otherwise.
- */
- // TODO remove this once the rules no longer reference it
- private boolean preprocessed;
-
/**
* Number of retries allowed, or {@code null} if no retries.
*/
/**
* Number of retries allowed, or {@code null} if no retries.
*/
*/
private Map<String, String> targetEntityIds;
*/
private Map<String, String> targetEntityIds;
- /**
- * Target entity.
- */
- // TODO to be removed
- private String targetEntity;
-
/**
* Timeout, in seconds, or {@code null} if no timeout. Zero and negative values also
* imply no timeout.
/**
* Timeout, in seconds, or {@code null} if no timeout. Zero and negative values also
* imply no timeout.
*
* @return a new operation outcome
*/
*
* @return a new operation outcome
*/
public OperationOutcome makeOutcome() {
public OperationOutcome makeOutcome() {
- return makeOutcome(getTargetEntity());
+ return makeOutcome(null);
params = ControlLoopOperationParams.builder().completeCallback(this::completer).requestId(REQ_ID)
.executor(executor).actorService(service).actor(ACTOR).operation(OPERATION).timeoutSec(TIMEOUT)
params = ControlLoopOperationParams.builder().completeCallback(this::completer).requestId(REQ_ID)
.executor(executor).actorService(service).actor(ACTOR).operation(OPERATION).timeoutSec(TIMEOUT)
- .startCallback(this::starter).targetEntity(MY_TARGET_ENTITY).build();
+ .startCallback(this::starter).build();
when(service.getActor(OperationPartial.GUARD_ACTOR_NAME)).thenReturn(guardActor);
when(guardActor.getOperator(OperationPartial.GUARD_OPERATION_NAME)).thenReturn(guardOperator);
when(service.getActor(OperationPartial.GUARD_ACTOR_NAME)).thenReturn(guardActor);
when(guardActor.getOperator(OperationPartial.GUARD_OPERATION_NAME)).thenReturn(guardOperator);
+ @Test
+ public void testMakeOutcome() {
+ oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, MY_TARGET_ENTITY);
+ assertEquals(MY_TARGET_ENTITY, oper.makeOutcome().getTarget());
+ }
+
@Test
public void testIsTimeout() {
final TimeoutException timex = new TimeoutException(EXPECTED_EXCEPTION);
@Test
public void testIsTimeout() {
final TimeoutException timex = new TimeoutException(EXPECTED_EXCEPTION);
assertEquals(OperationPartial.DEFAULT_RETRY_WAIT_MS, oper2.getRetryWaitMs());
}
assertEquals(OperationPartial.DEFAULT_RETRY_WAIT_MS, oper2.getRetryWaitMs());
}
- @Test
- public void testGetTargetEntity() {
- // get it from the params
- assertEquals(MY_TARGET_ENTITY, oper.getTargetEntity());
-
- // now get it from the properties
- oper.setProperty(OperationProperties.AAI_TARGET_ENTITY, "entityX");
- assertEquals("entityX", oper.getTargetEntity());
- }
-
@Test
public void testGetTimeOutMs() {
assertEquals(TIMEOUT * 1000, oper.getTimeoutMs(params.getTimeoutSec()));
@Test
public void testGetTimeOutMs() {
assertEquals(TIMEOUT * 1000, oper.getTimeoutMs(params.getTimeoutSec()));
params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer)
.requestId(REQ_ID).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload)
params = ControlLoopOperationParams.builder().actorService(actorService).completeCallback(completer)
.requestId(REQ_ID).executor(executor).actor(ACTOR).operation(OPERATION).payload(payload)
- .retry(RETRY).targetEntity(TARGET_ENTITY).timeoutSec(TIMEOUT)
- .startCallback(starter).preprocessed(true).build();
+ .retry(RETRY).timeoutSec(TIMEOUT)
+ .startCallback(starter).build();
outcome = params.makeOutcome(TARGET_ENTITY);
}
outcome = params.makeOutcome(TARGET_ENTITY);
}
@Test
public void testMakeOutcome() {
@Test
public void testMakeOutcome() {
- assertEquals(ACTOR, outcome.getActor());
- assertEquals(OPERATION, outcome.getOperation());
+ outcome = params.makeOutcome();
+ assertNull(outcome.getTarget());
+ checkRemainingFields("with actor");
+ }
+
+ @Test
+ public void testMakeOutcomeString() {
+ assertEquals(TARGET_ENTITY, outcome.getTarget());
checkRemainingFields("with actor");
}
protected void checkRemainingFields(String testName) {
checkRemainingFields("with actor");
}
protected void checkRemainingFields(String testName) {
- assertEquals(testName, TARGET_ENTITY, outcome.getTarget());
+ assertEquals(ACTOR, outcome.getActor());
+ assertEquals(OPERATION, outcome.getOperation());
assertNull(testName, outcome.getStart());
assertNull(testName, outcome.getEnd());
assertNull(testName, outcome.getSubRequestId());
assertNull(testName, outcome.getStart());
assertNull(testName, outcome.getEnd());
assertNull(testName, outcome.getSubRequestId());
testValidate("requestId", NULL_MSG, bldr -> bldr.requestId(null));
// has no target entity
testValidate("requestId", NULL_MSG, bldr -> bldr.requestId(null));
// has no target entity
- BeanValidationResult result = params.toBuilder().targetEntity(null).build().validate();
+ BeanValidationResult result = params.toBuilder().build().validate();
assertTrue(result.isValid());
// check edge cases
assertTrue(result.isValid());
// check edge cases
// test with minimal fields
assertTrue(ControlLoopOperationParams.builder().actorService(actorService).requestId(REQ_ID).actor(ACTOR)
// test with minimal fields
assertTrue(ControlLoopOperationParams.builder().actorService(actorService).requestId(REQ_ID).actor(ACTOR)
- .operation(OPERATION).targetEntity(TARGET_ENTITY).build().validate().isValid());
+ .operation(OPERATION).build().validate().isValid());
}
private void testValidate(String fieldName, String expected,
}
private void testValidate(String fieldName, String expected,
assertNull(ControlLoopOperationParams.builder().build().getPayload());
}
assertNull(ControlLoopOperationParams.builder().build().getPayload());
}
- @Test
- public void test() {
- assertTrue(params.isPreprocessed());
-
- // should be false when unspecified
- assertFalse(ControlLoopOperationParams.builder().build().isPreprocessed());
- }
-
@Test
public void testGetRetry() {
assertSame(RETRY, params.getRetry());
@Test
public void testGetRetry() {
assertSame(RETRY, params.getRetry());
public void testGetCompleteCallback() {
assertSame(completer, params.getCompleteCallback());
}
public void testGetCompleteCallback() {
assertSame(completer, params.getCompleteCallback());
}
-
- @Test
- public void testGetTargetEntity() {
- assertEquals(TARGET_ENTITY, params.getTargetEntity());
- }