summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actorServiceProvider/src/test
AgeCommit message (Collapse)AuthorFilesLines
2024-04-10Dependency management updateadheli.tavares1-4/+4
- including dependencies to pom.xml files only where they are used, avoiding extra dependencies being added in all packages. Issue-ID: POLICY-4945 Change-Id: I85b18befe3fe2877c754b1ac818d1b4994f9f7f9 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-09-22Java 17 Upgradeadheli.tavares2-14/+16
Issue-ID: POLICY-4669 Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-06-21Fix new checkstyle issues in modelsJim Hahn1-3/+0
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3094 Change-Id: I85314bc0249cba0020a0aefbc250851a2b646dd9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-11Fix sonars from depeendency upgradeJim Hahn18-88/+70
The dependency upgrades in policy-parent caused some new sonars. In particular, initMocks() has been deprecated - replaced with calls to the Mockito Runner, in most cases. Changed to openMocks() in one case and removed unnecessary stubbings. Issue-ID: POLICY-2905 Change-Id: I9aa098aa7aaebba09f6dcea4cac69ac1e5fbd4d6 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-10More sonars in modelsJim Hahn3-11/+10
Addressed the following: - make constructors protected - check exception type - too many assertions - remove annotation lists - use "<>" - reduce cognitive complexity - extract constant - multiple method calls in one assert - don't use eq() in verify() - indentation Issue-ID: POLICY-2905 Change-Id: I25bb3951f781250e9cdfe8f5f3b80cb63e129184 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-11-30Remove targetEntity from makeOutcomeJim Hahn5-37/+24
The Actor Params class had two flavors of makeOutcome, the second of which took a "targetEntity" parameter. As the Params no longer deal directly with the targetEntity, the second flavor was removed. Issue-ID: POLICY-2804 Change-Id: Ic736dd1c809ce54f6bb7cd37d03bc84cf4a1410c Signed-off-by: Jim Hahn <jrh3@att.com>
2020-11-20Delete preprocessed flag from actorsJim Hahn2-31/+21
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>
2020-10-27Make Actors event-agnosticJim Hahn5-397/+17
Removed event and event-context code from the Actor code. Also removed the preprocessing steps from the Actor code, giving the application complete control over any preprocessing. Also fixed a bug wherein the APPC actor was treating the AAI_RESOURCE_VNF property as a String instead of as a GenericVnf. Issue-ID: POLICY-2746-actor Change-Id: Ibc05fe39ffedc0bc461abf10e6a960861ac70119 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-27Remove Target and TargetTypePamela Dragosh6-87/+76
The dependency should have been removed in the last review to remove SDC and policy-yaml legacy code. It was revealed that usage of TargetType and Type were spread out over the actor code. Those fields are represented differently in the new TOSCA Operational Policy Type, so fields were created to capture those values to be used by actor code. Issue-ID: POLICY-2428 Change-Id: Ib783526a518ca7942ae9e38019bd343639f4dd98 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-18Make targetEntity a propertyJim Hahn5-22/+36
The target entity is not always known when an Operation is first constructed, thus it should be treated as an Operation property instead of being included within the ControlLoopParams. Started the process of moving it from the Params to the properties. Also fixed a bug in custom query - it was setting the outcome response to the String response instead of setting it to the AaiCqResponse object. Also added logging when an Operation's properties are set. Issue-ID: POLICY-2746 Change-Id: I56c0cd90985f6140363548b0b8d031471b586e88 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-13Do not require context in ControlLoopOperationParamsJim Hahn1-10/+48
Modified ControlLoopOperationParams so that the request ID can be provided instead of the context. However, if the request ID is not provided, then it still requires a context. (This requirement should be lifted in a subsequent review). Issue-ID: POLICY-2746 Change-Id: Ib00f46f2fe56430d700ee2edfba12f2c1a106a3f Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-04Skip preprocessor step in ActorsJim Hahn1-0/+9
Modified Actors to skip the preprocessor step if the "preprocessed" flag is set to true in the parameters. Did not add any error checking code to ensure the data was actually available to the operation - will add that once the properties are being set by the application code. Extracted common code in GrpcOperationTest into the setup method. Issue-ID: POLICY-2746 Change-Id: Id70c31a2c96a7aaa9d73cc70cdf4f55f8a4e087f Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-31Add property lists to ActorsJim Hahn7-15/+56
Modified the Actor code to provide a list of properties needed by the actor to perform a given operation. Added a build() method to the parameter class so invokers can build an operation and set its properties prior to starting it. Added a "preprocessed" field to the parameter class so invokers can indicate that the Actor need not perform any preprocessing steps. Will modify the actors, in a subsequent review, to observe the flag. Added "properties" to Operation so invokers can set the properties. Will modify the actors, in a subsequent review, to use the property values instead of the event context. Tweaked a few Actors to get values using the "params" object instead of reaching inside to the event object that it contains. Addressed review comment(s): - add prefix to other property names Issue-ID: POLICY-2746 Change-Id: I65996aef5cec5afe25e8287c0b2f5f322c532ca5 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-21Fix some sonars in policy-modelsJim Hahn3-3/+7
Fixed the following sonar issues in some of the project directories: - use assertNull, assertEquals, etc. - swap assertEquals arguments - extract a constant - don't invoke toString() in logger calls - TODOs - generic types Issue-ID: POLICY-2714 Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-13Remove legacy actor code from modelsJim Hahn2-95/+0
Deleted legacy actor code. That includes deleting most of the XxxManager classes. Issue-ID: POLICY-2559 Change-Id: I1ef1b900ca1d23e88da64b2c95a18986feb1b765 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-18Changes for Checkstyle 8.32liamfallon4-5/+4
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-12Moving common polling code into HttpOperationJim Hahn6-4/+665
SO and VFC have duplicate code for polling. Moved it into the common superclass. Issue-ID: POLICY-2632 Change-Id: I27128bfb2d54ef522b6b44ff569819a8463f3454 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-11Default ActorImpl should have an "operations" propertyJim Hahn5-25/+24
Added "operations" level to actor properties. Also renamed CommonActorParams to ActorParams, in the process. Note: This impacts the properties specified in drools-apps. Issue-ID: POLICY-2629 Change-Id: I155bcb6ced73cb54e656d34e0b184fb2ed6250d1 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-02Change Actor makeCoder() to getCoder()Jim Hahn3-5/+5
Issue-ID: POLICY-2603 Change-Id: I29d5c73f4b8b129bfdd6d0c9fb6d766b260e27c4 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-01Merge "Use "coder" to serialize Actor requests"Pamela Dragosh1-6/+8
2020-05-29Use "coder" to serialize Actor requestsJim Hahn1-6/+8
Modified the Actors to use the "coder" to serialize requests instead of defaulting to the HttpClient serialization provider. Decided to just pretty-print the requests since that can be used for both logging and transmission, which avoids serializing the request twice. Issue-ID: POLICY-2601 Change-Id: I190ed19dd852a1aa66156b358cbc97c3b121af1f Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-29Use default serialization providerJim Hahn1-2/+1
The default provider has been changed to gson, so the provider property no longer has to be set. Issue-ID: POLICY-1527 Change-Id: I3c829e2070617f85d998a56c0f58127d7f22b467 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-29Do not generate notification in SDNR ActorJim Hahn1-6/+0
Now that the SDNR Actor populates the operation outcome with the SDNR response, it no longer needs to populate the notification structure, as the application (e.g., drools-apps) can now generate the notification, itself, using the response. Issue-ID: POLICY-2593 Change-Id: Ie9bed0e59ca750211f17782fa7a2833c2087ac23 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-05-27Include response in OperationOutcomeJim Hahn4-2/+27
Added the response field and modified the actors to populate it. Issue-ID: POLICY-2592 Change-Id: I24487b6fbc23b69bde4a95acd470864d8231c49d Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-08SDNR Actor enhancementsJim Hahn1-0/+10
Made the following changes: - Enhanced SDNR Actor to support any operation name specified within the policy, constructing the same request, but passing a different "RPC name" and "Action" in the request. - Added ControlLoopResponse to OperationOutcome - Modified SDNR Actor to populate ControlLoopResponse Issue-ID: POLICY-2468 Change-Id: I50ee0674077d975f3cd211454656edc47d78520f Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-01Set sub request ID before start callbackJim Hahn2-20/+12
Modified new actor code to generate the sub request ID before invoking the start callback. Issue-ID: POLICY-2461 Change-Id: I4adabd6efda2c30c0e2da31f95f01dd5fe546c0a Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-30Test new actors against simulatorsJim Hahn1-0/+4
Also modified HttpParams to allow "path" to be blank to support any cases that really have no "path" to append to the context URI base path. Issue-ID: POLICY-2405 Change-Id: I49eebde6759659d2804b5a11c1504c37674bd0c4 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-25Cleanup eclipse warningsPamela Dragosh1-2/+1
Issue-ID: POLICY-2165 Change-Id: Iaad54af1b1210fe96fa44dcaa609834c46557877 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-03-23New Guard actor request structure is incorrectJim Hahn1-9/+3
Missing various fields within the request structure (e.g., ONAPName). Fixed. In the process, also modified makeGuardPayload() so that it only constructs the inner "guard" JSON object, making it easier for invoking code to modify it. Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7d34a279845bb98425caf66565eab7513d310815
2020-03-20Exception not propagated by processResponseJim Hahn1-1/+31
If the topic processResponse() method throws an exception, then the actor/operation is left in an incomplete state. Issue-ID: POLICY-2434 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I6c5d149d4046fbfb970c8dd831fc3938516d1115
2020-03-06Add subrequest ID to OperationOutcomeJim Hahn1-6/+11
Rule notifications need the subrequest ID to be populated in the OperationOutcome object, where possible. Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ic44320f67ad8df7bcb3000cfa667f95427818e71
2020-03-06Log full URL for REST callsJim Hahn1-11/+11
Actors only log the URI, without the host and port info. Modified to log the full URL. Also adjusted URLs for trailing "/". Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I0c9a2d139258ef23bc363a873b56f5cb4680247d
2020-03-05Add other APPC-LCM operationsJim Hahn1-0/+5
Also added legacy ModifyConfig as an operation within APPC-LCM. Added logging to topic registration keys. Issue-ID: POLICY-2403 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ia54a573fd6218a8afe870184b9a3baebc05b766a
2020-03-02Testcases for cds actorRam Krishna Verma2-6/+8
Adding test cases for cds actor, operator, operation & manager. Coverage is more than 95% overall. Fixed review comments. Issue-ID: POLICY-2384 Change-Id: I64beeb0c46918b990ad7e67248559169fc7940a1 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-03-01Merge "Add sequence number to Actors"Ram Krishna Verma2-2/+15
2020-02-29Add sequence number to ActorsJim Hahn2-2/+15
When actors with duplicate names are loaded, a way is needed to determine which should take precedence. Added a sequence number to Actor to facilitate this. Unfortunately, couldn't use OrderedServiceImpl, because it only creates the Actors once, which would break a number of junit tests. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I1ade92f4fe516cfc54bb92d0a3624c67e8981075
2020-02-29Sequence throws NPE if task outcome is nullJim Hahn1-0/+2
If a task outcome is null, then sequence() throws an NPE. Modified it to treat a null outcome as a failure. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I57b8be27f72c7cbf43e0b3b8816696ab1928f396
2020-02-26Change ActorService config to Map<String,Object>Jim Hahn1-1/+1
It's a bit of a pain to pass Map<String, Map<String,Object>> to the ActorService configure() method. Changed it to simply take a Map<String,Object>, as it had been in a previous iteration. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ib6e703115027bc4919cc93762ca5b38d254f2b8f
2020-02-26ActorService constructor should be publicJim Hahn1-0/+7
Now that ActorService is no longer a singleton, the constructor should be public so other classes can create an instance. Also added a test to verify that each ActorService instance gets its own instances of the actors. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I78cabecc0ca6b355696a5d27489a4e59b6e7c012
2020-02-25Remove ActorService singletonJim Hahn2-19/+7
The ActorService singleton is not needed at this time, so it was removed. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I9b4cbb72cedbeb77b39422e71650ab60c9aec7ec
2020-02-25Add PipelineUtilJim Hahn1-0/+37
Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7745e8286dd6f086941b979f16b2328bfa066788
2020-02-24Add "finalOutcome" flag to OperationOutcomeJim Hahn1-5/+33
The Actor clients receive notifications of operation failures, but no indication if it's the final failure, thus they do not know if they should progress on to the "failure" policies. Issue-ID: POLICY-2385 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: If053ed459e1d790e58eca950a8feeabaf4d67a41
2020-02-21Change payload to Map<String,Object> so it's more versatileJim Hahn9-62/+114
This was supposed to be two separate commits, but I goofed something. Added guard query to Operation superclass. Modified VfModuleCreate to store the VF count, pass it to the guard, and bump it once the create completes successfully. Added code to check Actors for proper plug-in to ActorService. Renamed "operation" property to "operations", to be more consistent with other parameters (e.g., TopicParameterGroup). The META-INF/services files for the actors had mixed case, which did not match the package name of the Actor class, preventing the ServiceLoader from recognizing them. Also modified the ActorService to skip any that cannot actually be loaded, for whatever reason (e.g., not in the classpath). Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ifa97744543f2866cc553138ec5ec644b033de780
2020-02-20More actor clean-upJim Hahn9-171/+289
Currently, Operator classes refer to Operation classes, and vice versa, creating a dependency cycle. In addition, there is a slight problem in that if an operator is reconfigured, any running operation may get inconsistent configuration data. Modified the code to create Config objects that are passed to the operation, instead of passing the Operator to the operations. This solved both issues. Replaceed makeOperator() with constructors. Added parameter type to HttpActors. Modified guard to get "ONAP" properties from its configuration, as a default. Changed setUp() to setUpBasic(), so "throws Exception" could be removed, thus resolving a sonar issue. Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I21eb8798acfbc636ff1bd8741b21c7278365b6e4
2020-02-18Actor updates to support SOJim Hahn2-2/+5
Used SuperBuilder in operation Params classes. Added rawResponse to http setOutcome(). Made HttpOperation.operator private. Issue-ID: POLICY-2371 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ie894f2e6ae4a31b69a700e425f9e94c5e8a15daa
2020-02-17More changes to actor codeJim Hahn2-8/+30
Use Coder.convert() from policy-common. Passed response to setOutcome(). Changed class names from XxxOperator to XxxOperation. Modified SDNC junits to invoke start() instead of startOperationAsync(). Changed context obtain() to re-run if the future was canceled. Added junit support class, BasicBidirectionalTopicOperation. Modified HttpOperation to allow subsequent requests to be issued. Some actors, like SO, send an initial HTTP request and then follow it with HTTP "are you done?" requests. Issue-ID: POLICY-2363-prop Change-Id: I12b5c2d4f07254e0cb79fabfe1ccf844b70a0654 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-02-17Use BidirectionalTopicClient from policy-commonJim Hahn18-972/+1043
Also modified "target" to sink in various places, and renamed various uses of "pair" to "bidirectional" (e.g., TopicPairParams => BidirectionalTopicParams). Also replaced MyExec with PseudoExecutor, from policy-common. As part of this, extracted the logRequest and logResponse methods from the Http and Topic classes, moving them into the common OperationPartial class. Modified A&AI, SDNC junit tests to use PseudoExecutor. Added support for incomplete responses on Topics, where multiple responses may be received for one request Fixed a duplicate entry in actor.aai pom. As the changes were already big enough, went ahead and also did the following to support the APPC Actor: - Reorganized parameter classes and content. - Modified anyOf, allOf to take functions instead of futures and handle exceptions thrown by any of the functions. Also added sequence() method. - Deleted doTask. - Modified ActorService.config to take a map of maps, not just a map. - Decided NOT to move anyOf, allOf, and sequence from OperationPartial to a utility class, because they depend on "params". Issue-ID: POLICY-2363 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I5a8bae05dfef22fe71c57c58f265b9dac20df5c5
2020-02-13Add Topic Actor superclassesJim Hahn12-42/+1465
Issue-ID: POLICY-2363 Change-Id: I5d29d85f6c5f40fb6c8f1bf678d9c718760a7558 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-02-12Add A&AI actor and some operatorsJim Hahn1-1/+1
Added A&AI Actor, as well as operators for the "custom query" and the "tenant" query (on which the custom query depends). Issue-ID: POLICY-1625 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Ic9dadc07a6057cb1abb9698da86eb9431fc9ed3e
2020-02-11Add more code to facilitate actor implementationJim Hahn14-1509/+2275
Added obtain() to Context Added startGuardAsync(), in anticipation of adding guards. Moved logRestXxx() from Util to HttpOperation. Added actor.test to facilitate testing of actors. Changed timeoutSec from long to int in various places. Made a couple of methods public to support junit testing. Most of the methods required Params to be passed, which indicated a design issue. Split Operator and Operation so that the Params could be kept in a field and thus need not be passed to every method. Basically, renamed OperatorPartial.java to OperationPartial.java and created a new OperatorPartial.java. Of course, this makes it look to gerrit like it's all new code, when in fact, most of it is unchanged, other than removing the Params argument to the method calls. That accounts for about half of the "lines changed" count. Issue-ID: POLICY-1625 Change-Id: I9e98c9dadcbed145bf84deb06c9db1c864a3c24a Signed-off-by: Jim Hahn <jrh3@att.com>