Package com.levelaccess.continuum
Class AMPReportingService
java.lang.Object
com.levelaccess.continuum.AMPReportingService
This class encapsulates all functionality for submitting accessibility concerns identified using Continuum to AMP.
Reporting test results from Continuum to AMP is accomplished through a kind of state machine, where you set the active AMP instance, organization, asset, report, and module to use; once these are set, they remain set for as long as they're not set again and for as long as Continuum is initialized.
Depending on the report and module management strategies you decide to use (see
AMPReportingService.ReportManagementStrategy and AMPReportingService.ModuleManagementStrategy, respectively), invoking submitAccessibilityConcernsToAMP(List) will first create, overwrite, and/or delete reports and modules from AMP, then publish your test results to the active AMP module.
You can set the active report and module management strategies using setActiveReportManagementStrategy(ReportManagementStrategy) and setActiveModuleManagementStrategy(ModuleManagementStrategy), respectively.
Only once all of these active items are set should you invoke submitAccessibilityConcernsToAMP(List) using the list of accessibility concerns you'd like to report.
More on report and module management strategies: they are designed with two primary use cases in mind: continuous integration (CI) workflows (where you usually want to retain the results of previously published reports), and more manual workflows (e.g. when Continuum is run from a developer's local workstation, where you usually don't want to retain the results of previously published reports).
Choosing the correct report and module management strategies to meet your business objectives is critical to using Continuum's AMP reporting functionality correctly, so please consult our support documentation for more information.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class encapsulates all the metadata relevant to an AMP module.static enumDefines supported strategies with which to create new modules and edit existing ones.classThis class encapsulates all the metadata relevant to an AMP report.static enumDefines supported strategies with which to create new reports and edit existing ones. -
Method Summary
Modifier and TypeMethodDescriptionGets the active module.Gets the active report.voidsetActiveAsset(Integer assetId) Validates the specified ID of an existing asset in AMP, then sets it as the active asset in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active asset.voidsetActiveModule(Integer moduleId) Validates the specified ID of an existing module in AMP, then sets it as the active module in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active module.setActiveModule(String moduleName, String moduleLocation) Sets the active module in AMP to submit test results to next timesubmitAccessibilityConcernsToAMP(List)is invoked.voidsetActiveModuleManagementStrategy(AMPReportingService.ModuleManagementStrategy moduleManagementStrategy) Sets the active module management strategy to use next timesubmitAccessibilityConcernsToAMP(List)is invoked.voidsetActiveOrganization(Integer organizationId) Validates the specified ID of an existing organization in AMP, then sets it as the active organization in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active organization.voidsetActiveReport(Integer reportId) Validates the specified ID of an existing report in AMP, then sets it as the active report in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active report.setActiveReport(String reportName) Sets the active report in AMP to submit test results to next timesubmitAccessibilityConcernsToAMP(List)is invoked.voidsetActiveReportManagementStrategy(AMPReportingService.ReportManagementStrategy reportManagementStrategy) Sets the active report management strategy to use next timesubmitAccessibilityConcernsToAMP(List)is invoked.booleansubmitAccessibilityConcernsToAMP(List<AccessibilityConcern> accessibilityConcerns) Submits accessibility concerns to the active AMP instance, organization, asset, report, and module.
-
Method Details
-
setActiveOrganization
public void setActiveOrganization(Integer organizationId) throws IllegalArgumentException, HttpErrorException, NotFoundException Validates the specified ID of an existing organization in AMP, then sets it as the active organization in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active organization.- Parameters:
organizationId- the ID of the AMP organization to make active- Throws:
IllegalArgumentException- if the specified organization ID is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified organization IDNotFoundException- if the specified organization may not exist in the active AMP instance or is otherwise not accessible
-
setActiveAsset
public void setActiveAsset(Integer assetId) throws IllegalArgumentException, HttpErrorException, NotFoundException Validates the specified ID of an existing asset in AMP, then sets it as the active asset in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active asset. Make sure you first set the active organization for this asset prior to invoking this function usingsetActiveOrganization(Integer).- Parameters:
assetId- the ID of the AMP asset to make active- Throws:
IllegalStateException- if the active organization is not setIllegalArgumentException- if the specified asset ID is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified asset IDNotFoundException- if the specified asset may not exist in the active AMP instance or is otherwise not accessible
-
setActiveReport
public void setActiveReport(Integer reportId) throws IllegalStateException, IllegalArgumentException, HttpErrorException, NotFoundException Validates the specified ID of an existing report in AMP, then sets it as the active report in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active report. Make sure you first set the active organization and asset for this report prior to invoking this function usingsetActiveOrganization(Integer)andsetActiveAsset(Integer), respectively.- Parameters:
reportId- the ID of the AMP report to make active- Throws:
IllegalStateException- if the active organization or asset is not setIllegalArgumentException- if the specified report ID is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified report IDNotFoundException- if the specified report may not exist in the active AMP instance or is otherwise not accessible
-
setActiveReport
public Integer setActiveReport(String reportName) throws IllegalStateException, IllegalArgumentException, HttpErrorException Sets the active report in AMP to submit test results to next timesubmitAccessibilityConcernsToAMP(List)is invoked. The report name specified is validated, but unlikesetActiveReport(Integer), this method will not throw an exception if the specified report does not yet exist in AMP; it will be created next timesubmitAccessibilityConcernsToAMP(List)is invoked. Make sure you first set the active organization and asset for this report prior to invoking this function usingsetActiveOrganization(Integer)andsetActiveAsset(Integer), respectively.- Parameters:
reportName- the name of the AMP report to make active- Returns:
- the ID of the AMP report, if it already exists; null if the report does not yet exist in AMP
- Throws:
IllegalStateException- if the active organization or asset is not setIllegalArgumentException- if the specified report name is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified report name
-
setActiveModule
public void setActiveModule(Integer moduleId) throws IllegalStateException, IllegalArgumentException, HttpErrorException, NotFoundException Validates the specified ID of an existing module in AMP, then sets it as the active module in Continuum such that next timesubmitAccessibilityConcernsToAMP(List)is invoked, test results will be submitted to this active module. Make sure you first set the active organization, asset, and report for this module prior to invoking this function usingsetActiveOrganization(Integer),setActiveAsset(Integer), andsetActiveReport(Integer)orsetActiveReport(String), respectively. While usingAMPReportingService.ReportManagementStrategy.OVERWRITEas your report management strategy, usesetActiveModule(String, String)instead of this method; see the documentation forAMPReportingService.ReportManagementStrategy.OVERWRITEfor details as to why.- Parameters:
moduleId- the ID of the AMP module to make active- Throws:
IllegalStateException- if the active organization, asset, or report is not setIllegalArgumentException- if the specified module ID is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified module IDNotFoundException- if the specified module may not exist in the active AMP report
-
setActiveModule
public Integer setActiveModule(String moduleName, String moduleLocation) throws IllegalStateException, IllegalArgumentException, HttpErrorException Sets the active module in AMP to submit test results to next timesubmitAccessibilityConcernsToAMP(List)is invoked. The module name specified is validated if the active report already exists in AMP, but unlikesetActiveModule(Integer), this method will not throw an exception if the specified module does not yet exist in AMP; it will be created next timesubmitAccessibilityConcernsToAMP(List)is invoked. Make sure you first set the active organization, asset, and report for this module prior to invoking this function usingsetActiveOrganization(Integer),setActiveAsset(Integer), andsetActiveReport(Integer)orsetActiveReport(String), respectively.- Parameters:
moduleName- the name of the AMP module to make activemoduleLocation- the name of the location in the website or app being tested; this can be a fully qualified URL, or simply a page title like "Login Page"- Returns:
- the ID of the AMP module, if it already exists; null if the module does not yet exist in AMP
- Throws:
IllegalStateException- if the active organization, asset, or report is not setIllegalArgumentException- if the specified module name or location is nullHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the specified module name
-
setActiveReportManagementStrategy
public void setActiveReportManagementStrategy(AMPReportingService.ReportManagementStrategy reportManagementStrategy) Sets the active report management strategy to use next timesubmitAccessibilityConcernsToAMP(List)is invoked. Choosing the correct report and module management strategies to meet your business objectives is critical to using Continuum's AMP reporting functionality correctly, so please consult our support documentation for more information.- Parameters:
reportManagementStrategy- the preferred management strategy to use when creating and editing AMP reports
-
setActiveModuleManagementStrategy
public void setActiveModuleManagementStrategy(AMPReportingService.ModuleManagementStrategy moduleManagementStrategy) Sets the active module management strategy to use next timesubmitAccessibilityConcernsToAMP(List)is invoked. Choosing the correct report and module management strategies to meet your business objectives is critical to using Continuum's AMP reporting functionality correctly, so please consult our support documentation for more information.- Parameters:
moduleManagementStrategy- the preferred management strategy to use when creating and editing AMP modules
-
submitAccessibilityConcernsToAMP
public boolean submitAccessibilityConcernsToAMP(List<AccessibilityConcern> accessibilityConcerns) throws NotFoundException, HttpErrorException Submits accessibility concerns to the active AMP instance, organization, asset, report, and module. Make sure to set the active AMP organization (viasetActiveOrganization(Integer)), asset (viasetActiveAsset(Integer)), report (viasetActiveReport(Integer)orsetActiveReport(String)), and module (viasetActiveModule(Integer)orsetActiveModule(String, String)) prior to invoking this function. The active instance, organization, and asset must all already exist in AMP prior to invoking this function, otherwise an exception will be thrown; reports and modules don't need to exist in AMP yet, as they will be created if necessary. Also, make sure to set your desired report and module management strategies prior to invoking this function usingsetActiveReportManagementStrategy(ReportManagementStrategy)andsetActiveModuleManagementStrategy(ModuleManagementStrategy), respectively, according to your use case. Choosing the correct report and module management strategies to meet your business objectives is critical to using Continuum's AMP reporting functionality correctly, so please consult our support documentation for more information.- Parameters:
accessibilityConcerns- the list of accessibility concerns to submit to AMP- Returns:
- true if uploading of the specified accessibility concerns to AMP succeeded; false if it did not
- Throws:
IllegalStateException- if the active instance, organization, asset, report, or module is not setHttpErrorException- if an error is encountered while attempting to connect to AMP to validate the active organization, asset, report, or moduleNotFoundException- if the active instance, organization, or asset may not exist in AMP as specified, or if an error occurs while attempting to create the necessary report or module in AMP (if applicable)
-
getActiveReport
Gets the active report. This is null ifsetActiveReport(Integer)orsetActiveReport(String)hasn't been invoked to set an active report yet. Use this to access the active report's metadata, e.g. its ID in AMP, its name, etc.- Returns:
- the active report
-
getActiveModule
Gets the active module. This is null ifsetActiveModule(Integer)orsetActiveModule(String, String)hasn't been invoked to set an active module yet. Use this to access the active module's metadata, e.g. its ID in AMP, its name, etc.- Returns:
- the active module
-