aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
AgeCommit message (Collapse)AuthorFilesLines
2019-04-11Updated to use dublin schema versionPolavarapu, Chaitanya (cp8128)3-2/+74
Using 1.0.2 schema-service version Fixed the junit test failure for default service version Issue-ID: AAI-2338 Change-Id: Ie0ddda41f6895ff0ce8e97ad065fb935462e643a Signed-off-by: Polavarapu, Chaitanya (cp8128) <cp8128@att.com>
2019-04-10This enhancement will enable Babel to process artifacts of version n.nPolavarapu, Chaitanya (cp8128)17-17/+17
Issue-ID: AAI-2338 Change-Id: I829ba56aa09ac1d98a8c9d27fabb85d95d571534 Signed-off-by: Polavarapu, Chaitanya (cp8128) <cp8128@att.com>
2019-04-03GenerateArtifactsServiceImpl code coveragemark.j.leonard1-9/+95
Additional tests for coverage of the generateArtifacts() implementation. Replace use of the generic Exception by catching only the specific types of Exception thrown by the parser/generators. Modify existing tests to ensure that each branch is covered. Change-Id: Id35e8a4a51b785f0367ac04a31ed23226cdb4810 Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-04-03Fix new Sonar code smellmark.j.leonard1-2/+1
Log the Exception for missing software versions to prevent a Sonar violation. Change-Id: I1a5da4357947a57c05f2d4a40b788999149d543c Issue-ID: AAI-2281 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-04-03Delete temp file in FileWatcher testmark.j.leonard1-0/+1
Ensure the temporary file is deleted after the test completes. Change-Id: I25fbab4c28d9489df0ed9b6cb74a068873aa9854 Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-04-03Add tests for uncovered FileWatcher codemark.j.leonard1-0/+81
Move the onChange() method so that it can be tested. Change-Id: I8a011ae581a16cf31e9573e6d4c9b2fa1c858b8a Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-04-03Merge "Move REQUIRE_CLIENT_AUTH code to start script"Tian Lee1-0/+14
2019-04-03Move REQUIRE_CLIENT_AUTH code to start scriptmark.j.leonard1-0/+14
Move the conversion from the REQUIRE_CLIENT_AUTH env variable to the Spring setting server.ssl.client-auth out of the Java code and in to the start script. This declutters the code and exposes this setting. Refactor the code for readability: have Jetty deobfuscate the password string for us rather than manually detecting the "OBF:" prefix. Also fix a typo (spelling mistake). Change-Id: Ic670c04f97f59e06e48ca2cf4d7a0188020b3eaa Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-04-02Merge "Additional Logger tests for code coverage"Tian Lee2-6/+56
2019-04-02Additional Logger tests for code coverageMark Leonard2-6/+56
Change-Id: Ib94fc61ae43d59a32fba19363b06dc7aed5a96bc Issue-ID: AAI-2280 Signed-off-by: Mark Leonard <mark.j.leonard@gmail.com>
2019-04-01Exception handling for image software versionsmark.j.leonard2-9/+28
Throw an exception when no software versions are present for a VNF image. This needs to be an unchecked exception when using Streams. Change-Id: If7a429c79a614eed1dad6ed8ac1993caca47ab6d Issue-ID: AAI-2306 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-29Additional null checks and commentsmark.j.leonard3-8/+11
Add defensive coding to check for possible null pointer values, thus preventing certain potential runtime exceptions. Fix some minor spelling inconsistencies. Refactor some method signatures and update the Javadoc. Reformat Resource toString() method to avoid lengthy String concatenation and duplicated separators. Change-Id: I4b01eb844700e00d0c909bcc5fa2dbc91d5149e4 Issue-ID: AAI-2281 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-28Use checked Exception instead of RuntimeExceptionmark.j.leonard1-13/+23
Replace IllegalArgumentException with XmlArtifactGenerationException in the ArtifactGeneratorToscaParser method processResourceModels(). Add comments to explain the processing. Change-Id: Icf401ae22ebe26d687fc58c33743582c9c9e576e Issue-ID: AAI-2281 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-28Depend on sdc-tosca version 1.5.0mark.j.leonard1-8/+6
Replace the following deprecated API methods with equivalent functions: getGroupsOfOriginOfNodeTemplate() getNodeTemplateCustomizationUuid() getNodeTemplateChildren() getServiceVfList() getMembersOfVfModule() getVfModulesByVf() Create a helper class and move the remaining deprecated API calls into a single Java file for ease of maintenance. Change-Id: Icb08b2d66a34b0a3e717adb49f2d62e8f2e2ddb5 Issue-ID: AAI-2294 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-28Change generic-vnf delete flag to truemark.j.leonard2-2/+2
Alter the test values for the generic-vnf Widget Type to match the actual configured values used in historic deployments of the Babel Service. The test values will then be aligned to the actual run-time values thus avoiding any confusion caused by the disparity. Issue-ID: AAI-2292 Change-Id: Ia8bef2e31d62027c4edb636a78c8cde93da6638b Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-28Remove all references to artifactgenerator configmark.j.leonard9-61/+6
Delete the artifact-generator.properties file. Remove all related functionality from the code. Change-Id: I652d99b6424bb60af5820f5afb97ef139e3f9511 Issue-ID: AAI-2284 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-26Allow UUID definitions in the mappings JSONmark.j.leonard5-502/+54
Add support for reading the Widget invariant and version UUIDs from the TOSCA mappings JSON. In this commit the artifact-generator.properties is also read and used to provide default values. This step prevents any existing deployments (e.g. automated test integration) from failing. The redundant properties file will be deprecated in a future commit, only when the JSON configuration has been updated. Also remove two unused Java files to help with coverage stats. Change-Id: Idc82e28092a2b028214225c7974db411c9f8a173 Issue-ID: AAI-2284 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-25Refactor Widget creation methodsmark.j.leonard4-57/+70
Rename getWidget() to createWidget() to indicate that a new Object is created. Add a method to create a Widget from the String representation of its type. Change-Id: I430acf02ea67c7b730e28e79887f8fbdb18feb42 Issue-ID: AAI-2281 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-25Additional JUnit tests for Model classesmark.j.leonard5-20/+105
Increase code coverage for Model and Service Change-Id: I02430f470cfa6497535a372a0b18be8678279270 Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-25Improve javadoc comments and formattingmark.j.leonard1-1/+6
Issue-ID: AAI-2281 Change-Id: I0f5cce16ce76113b1fee603ad3c191cb6f9fe80f Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-22Simplify VNF Vendor Image extractionmark.j.leonard1-15/+7
Refactoring of the software version extraction routines to reduce complexity. Pass the NodeTemplates directly to the extractSoftwareVersions() method and move the exception handling up the calling stack. Remove the creation/usage of an intermediate Pair object. Query for the Service VF list once only. Use Streams rather than converting from Stream to List and back. This change will simplify future work: either to convert sdc-tosca API methods (that will be deprecated), or to use an alternative parser. Change-Id: I745ced9e6095f389ee1bede37e8480dfaf65716a Issue-ID: AAI-2281 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-22New JUnit tests for Babel auth modulemark.j.leonard2-19/+118
Increase code coverage Change-Id: I7eb50720fb20ce44ff87c0011e784a77606cf9ff Issue-ID: AAI-2280 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-11Refactor auth classes and add testsmark.j.leonard2-5/+118
Add new tests to give better coverage of the authorization classes. Refactor the core class for readability. Change-Id: I2be467d8f4492249a0c29be8b108bb2bce2818dd Issue-ID: AAI-2229 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-11Test starting application with OBF: passwordmark.j.leonard1-0/+12
Test an uncovered code path. Remove the unnecessary declaration of the Jetty OBF: prefix constant String. Ensure that the Spring Application exits before the next JUnit test runs. Change-Id: Iceb2e79a923359c15ca6ad366c2ac94a63e381b0 Issue-ID: AAI-2229 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-11Reimplement Widget.Type enum classmark.j.leonard4-119/+132
Replace this with a WidgetType dynamic enumeration, which may be extended at runtime. Load the Widget Types from the mapping configuration (JSON file). Issue-ID: AAI-2229 Change-Id: I5d1bc4291b4446f6d744821bf1d74b1f117b901f Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-11Additional JUnit tests for code coveragemark.j.leonard3-0/+160
Improve code coverage to address Sonar code smells. Include a dummy keystore file to allow the Spring Boot Application to start up without error. Change-Id: Ifab33a67e5d051baacfad91d3f317a8fb8b0a669 Issue-ID: AAI-2212 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-07Re-implement model type value for Resource Mappingmark.j.leonard2-40/+25
Refactor the Model/Service/Resource/Widget hierarchy to improve code readability. Replace the configurable Boolean value for a Resource's model type with a value from the existing ModelType enum. Obtain the A&AI XML Model name (always resource or service) directly from the Model class and not from the configured model type for the Resource. Change-Id: I1487d919392b34e4bf1314da8cd2805a9fbf96a3 Issue-ID: AAI-2212 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-06Remove redundant methods from codebasemark.j.leonard2-18/+1
Delete methods that are never called (or only called from test code) Issue-ID: AAI-2212 Change-Id: I1554bd76de4a9ac2e3cc05987dac1d04966b9200 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-06Add JUnit test for invalid TOSCA mappings JSONmark.j.leonard10-73/+63
Add a test to improve code coverage. Also tidy up some out of date test code comments and unnecessary structural code. Change-Id: Ib38a3d602bc5ae46d16f3067d1d3e0ba0838c446 Issue-ID: AAI-2212 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-05Fix checkstyle warnings and formattingmark.j.leonard3-15/+38
Add Javadoc and make cosmetic changes to prevent Checkstyle messages Change-Id: Ibab7be42d6a01b181cdb625b6b34d580658c7046 Issue-ID: AAI-2212 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-03-05Move Widget attribute data to the mappings JSONmark.j.leonard11-49/+283
Extend the TOSCA mappings JSON content by adding a set of of Widget types defining the type name and data-delete flag. In this change the set of supported types (defined by an enum) remains. However the intention is to replace this in a future commit. The hierarchy of annotated Widget types is replaced by this new configuration, which is accessed from the Widget class. Refactoring has been kept to a minimum to simplify the code review process but further improvements can now be made. Ideally the set of supported Widgets can be extended through configuration changes only. Change-Id: I005cfe6976778b14f14c3ad06d8acf3745c8dd8f Issue-ID: AAI-2212 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-02-19Fix outstanding Sonar issuesmark.j.leonard3-25/+41
Change-Id: I9699ee13321f136b4460d5c85d49ab13378f52b4 Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-02-11Rename the groupfilter.config System Propertymark.j.leonard5-14/+40
Rename the System Property to be tosca.mappings.config and default the value to ${CONFIG_HOME}/tosca-mappings.json Update Java code and comments to remove the word "filter" where this is now outdated. Add new JUnit tests for better code coverage. Change-Id: Iaa9685638e099c898894171a958b0d5d51542fde Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-02-05Fix checkstyle issues including javadocmark.j.leonard7-35/+86
Minor code tidy-ups: mostly formatting and Javadoc comments Change-Id: I8a9ab692428fa09c73bd1fb542100610a86f6eca Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-02-05Replace Resource sub-classes with configurationmark.j.leonard4-77/+136
Delete the sub-classes of the Resource (internal Model class) and replace the annotated properties of these classes with TOSCA-to-Model mappping data loaded from the JSON configuration. Change-Id: I56d5d9d4893be45eb42ae65099ea9abe5f4409b9 Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2019-01-30Load type mappings from a group configuration filemark.j.leonard11-133/+188
Change the filter-types.properties file: re-implement to use JSON content. Remove the System Property that defines the location of the file and add this to the Spring application properties. Initialise the type-to-model mappings using the key=value pairs from this JSON content. Refactor existing Junit tests to remove duplicated resource loading code. Change-Id: Idb2e962fe5cae39b70cc8cf16053d0a253f4fac0 Issue-ID: AAI-2121 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-12-05Throw an Exception for XML test file mismatchesmark.j.leonard2-198/+211
Fix a bug that masked differences between expected and actual XML files. This affects JUnit tests only. Change-Id: I72c779c008baa9fba52c09a0751cdd25bdc0e5cc Issue-ID: AAI-1991 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-12-05Compare YML files as Strings, not XMLmark.j.leonard1-30/+21
Simplify the JUnit testing for the YAML file extractor and compare the actual and expected files using Strings (with line endings normalized). Change-Id: Ie78d3506511b4a1d5333c1b0b95a676bbc2ab5e2 Issue-ID: AAI-1991 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-27Process Service-level Instance Groupsmark.j.leonard7-113/+255
Create an InstanceGroup XML model for groups of the Service topology template in the case where there is no Resource model generated. Add a test CSAR file for a Service Proxy (an unsupported type). Assert that the Service is associated with the instance-group Models. Change-Id: If76bf7a1cfb960bc8692f1e136ee85176725915e Issue-ID: AAI-1963 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-27Refactor model generation algorithmmark.j.leonard1-12/+35
Reorganize the Service and Resource Model generation code for readability. Resort methods to put public before private. Rename generateService() to generateAllArtifacts() Reimplement this method such that the NodeTemplate list is iterated once only. This is intended to simplify future changes to the code. Change-Id: Ie0c6003eab99f42945747c6d79827881e05afc87 Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-22Refactor Instance Group processingmark.j.leonard2-267/+266
Minor refactoring and reformatting of Java code using Eclipse. Add private method mergeProperties() to replace duplicated code logic for populating the Group model. Change-Id: I1360bbbf5b065149028a94392dd530af9c9153e8 Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-09Add support for ResourceInstanceGroupmark.j.leonard2-4/+91
Refactor existing code and add a Junit test for the relevant method. Change-Id: I66703f1d2e93173df4676070faf66e289360609a Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-09Minor formatting fixesmark.j.leonard3-2/+0
Non-functional changes addressing whitespace inconsistencies. Change-Id: Ife84f6b04bf8ce0204409d2f3708ab85b3a3caff Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-11-08Add a CSAR test file containing an InstanceGroupmark.j.leonard7-6/+208
Add a test CSAR file to ensure that the ArtifactGeneratorToscaParser method processInstanceGroup() is covered, prior to refactoring. Change-Id: I277b6721c8a406631d54716aa68b313b1937e5cf Issue-ID: AAI-1884 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-10-26Do not apply timezone offsets to the test Clock1.3.1mark.j.leonard1-1/+1
Use UTC for the Clock value that is passed to the Info Service as a test, to avoid any Daylight Savings adjustments. Change-Id: Id9cafdae6e63bd5908ffe8f61ca21c617e86b08b Issue-ID: AAI-1766 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-10-24Fix JUnit test for the Info status reportmark.j.leonard1-7/+7
The ZoneOffset was being applied twice, causing the number of hours added to a test Clock to be calculated incorrectly only when Daylight Savings changes were applied during the interval. For example, the status report was showing 4 days 23 hrs instead of 5 days when the clocks had been put back an hour. Change-Id: If6380a8901b2723018dd3a45fcd7df3ffa0168d4 Issue-ID: AAI-1766 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-09-10Add support for InstanceGroup resource modelsmark.j.leonard6-13/+59
Generate models for Instance Groups (for specific supported types). Process groups with a metadata type of CR or Configuration. Add InstanceGroup Widget to the supported Widgets. Add support for a group filter properties resource/file (with the single property key "AAI.instance-group-types" which provides a comma-separated list of supported types). Add the System Propery groupfilter.config to define the file path. Change-Id: I6153e6284965c57ae43291b1dc3ee4a1d11e6583 Issue-ID: AAI-1579 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-09-10Simplify input CSAR test datamark.j.leonard4-1/+1
Remove unnecessary data from the test input files. Only the TOSCA YAML content is needed for testing Babel functionality. Change-Id: I25a459f70a0ea6adb64aa87965044b63e2eeb273 Issue-ID: AAI-1250 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-09-06Additional tests for VNF image extractionmark.j.leonard5-6/+200
New tests for extracting software versions. Change-Id: I26a9d654d03154a1d026741e623c8f953946a5f4 Issue-ID: AAI-1250 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
2018-09-06Refactor Junit test code to remove duplicationmark.j.leonard9-126/+185
Simplify the code by introducing an Enum to store each of the test input CSAR files. Add common functionality to this Enum class. Change-Id: I3c44d7ec3b7808a193b8918c43cf0a9eb5369533 Issue-ID: AAI-1250 Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>