├── .circleci ├── config.yml └── settings.xml ├── .gitignore ├── .mvn └── wrapper │ ├── MavenWrapperDownloader.java │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── Procfile ├── README.md ├── bin ├── import_usage_point.sh ├── install_common.sh ├── load_mysql.sh ├── load_psql.sh ├── run_tests.sh ├── update_notice.sh └── update_relish.sh ├── etc ├── DataCustodianDatabaseSchema.png ├── DataCustodianMySQL.sql ├── NOTICE.template ├── OAuthTokenstore.mwb └── license-mappings.xml ├── mvnw ├── mvnw.cmd ├── pom.xml ├── settings-example.xml ├── settings.xml ├── src ├── main │ ├── java │ │ └── org │ │ │ └── greenbuttonalliance │ │ │ └── espi │ │ │ └── datacustodian │ │ │ ├── atom │ │ │ └── EspiEntry.java │ │ │ ├── console │ │ │ └── ImportUsagePoint.java │ │ │ ├── oauth │ │ │ ├── AccessConfirmationController.java │ │ │ ├── EspiTokenEnhancer.java │ │ │ ├── EspiUserApprovalHandler.java │ │ │ └── OauthAdminController.java │ │ │ ├── service │ │ │ ├── UpdateService.java │ │ │ └── impl │ │ │ │ └── UpdateServiceImpl.java │ │ │ ├── utils │ │ │ ├── URLHelper.java │ │ │ └── VerifyURLParams.java │ │ │ └── web │ │ │ ├── BaseController.java │ │ │ ├── DefaultController.java │ │ │ ├── HomeController.java │ │ │ ├── LoginController.java │ │ │ ├── VersionRESTController.java │ │ │ ├── api │ │ │ ├── ApplicationInformationRESTController.java │ │ │ ├── AuthorizationRESTController.java │ │ │ ├── BatchRESTController.java │ │ │ ├── ElectricPowerQualitySummaryRESTController.java │ │ │ ├── ElectricPowerUsageSummaryRESTController.java │ │ │ ├── IntervalBlockRESTController.java │ │ │ ├── ManageRESTController.java │ │ │ ├── MeterReadingRESTController.java │ │ │ ├── ReadingTypeRESTController.java │ │ │ ├── RetailCustomerRESTController.java │ │ │ ├── ServiceStatusRESTController.java │ │ │ ├── TimeConfigurationRESTController.java │ │ │ └── UsagePointRESTController.java │ │ │ ├── custodian │ │ │ ├── AssociateUsagePointController.java │ │ │ ├── CustodianHomeController.java │ │ │ ├── ManagementController.java │ │ │ ├── RetailCustomerController.java │ │ │ ├── UploadController.java │ │ │ └── UploadForm.java │ │ │ ├── customer │ │ │ ├── CustomerDownloadMyDataController.java │ │ │ ├── CustomerHomeController.java │ │ │ ├── MeterReadingController.java │ │ │ ├── ScopeSelectionController.java │ │ │ ├── ThirdPartyController.java │ │ │ └── UsagePointController.java │ │ │ └── filter │ │ │ ├── CORSFilter.java │ │ │ └── ResourceValidationFilter.java │ ├── resources │ │ ├── commons-logging.properties │ │ ├── log4j.properties │ │ ├── simplelog.properties │ │ └── spring │ │ │ ├── business-config.xml │ │ │ ├── data-config.xml │ │ │ ├── datasource-config.xml │ │ │ ├── hsql-data-access.properties │ │ │ ├── mysql-data-access.properties │ │ │ ├── oauth-AS-config.xml │ │ │ └── oauth-RS-config.xml │ └── webapp │ │ ├── WEB-INF │ │ ├── applicationContext.xml │ │ ├── jsp │ │ │ ├── 400.jsp │ │ │ ├── 403.jsp │ │ │ ├── Sponsors.jsp │ │ │ ├── TermsOfService.jsp │ │ │ ├── UsagePolicy.jsp │ │ │ ├── about.jsp │ │ │ ├── access_confirmation.jsp │ │ │ ├── custodian │ │ │ │ ├── home.jsp │ │ │ │ ├── oauth │ │ │ │ │ └── tokens.jsp │ │ │ │ ├── retailcustomers │ │ │ │ │ ├── show.jsp │ │ │ │ │ └── usagepoints │ │ │ │ │ │ └── form.jsp │ │ │ │ └── upload.jsp │ │ │ ├── customer │ │ │ │ ├── error.jsp │ │ │ │ ├── home.jsp │ │ │ │ ├── meterreadings │ │ │ │ │ └── show.jsp │ │ │ │ ├── thirdparties │ │ │ │ │ └── index.jsp │ │ │ │ └── usagepoints │ │ │ │ │ ├── index.jsp │ │ │ │ │ └── show.jsp │ │ │ ├── error.jsp │ │ │ ├── home.jsp │ │ │ ├── login.jsp │ │ │ ├── oauth_error.jsp │ │ │ ├── retailcustomers │ │ │ │ ├── form.jsp │ │ │ │ └── index.jsp │ │ │ └── tiles │ │ │ │ ├── custodian │ │ │ │ ├── header.jsp │ │ │ │ └── oauth │ │ │ │ │ └── header.jsp │ │ │ │ ├── customer │ │ │ │ └── header.jsp │ │ │ │ ├── footer.jsp │ │ │ │ ├── head.jsp │ │ │ │ └── header.jsp │ │ ├── spring-servlet.xml │ │ └── web.xml │ │ ├── images │ │ ├── bg.gif │ │ └── header.jpg │ │ └── resources │ │ ├── bootstrap-datetimepicker-0.0.11 │ │ ├── css │ │ │ └── bootstrap-datetimepicker.min.css │ │ └── js │ │ │ └── bootstrap-datetimepicker.min.js │ │ ├── css │ │ ├── application.css │ │ ├── bootstrap-datetimepicker.min.css │ │ ├── bootstrap-responsive.css │ │ ├── bootstrap.css │ │ ├── datepicker.css │ │ └── docs.css │ │ ├── ico │ │ ├── apple-touch-icon-114-precomposed.png │ │ ├── apple-touch-icon-144-precomposed.png │ │ ├── apple-touch-icon-57-precomposed.png │ │ ├── apple-touch-icon-72-precomposed.png │ │ ├── favicon.ico │ │ └── favicon.png │ │ ├── img │ │ ├── Green_Download_265.png │ │ ├── bootstrap-docs-readme.png │ │ ├── bootstrap-mdo-sfmoma-01.jpg │ │ ├── bootstrap-mdo-sfmoma-02.jpg │ │ ├── bootstrap-mdo-sfmoma-03.jpg │ │ ├── bs-docs-bootstrap-features.png │ │ ├── bs-docs-masthead-pattern.png │ │ ├── bs-docs-responsive-illustrations.png │ │ ├── bs-docs-twitter-github.png │ │ ├── example-sites │ │ │ ├── 8020select.png │ │ │ ├── adoptahydrant.png │ │ │ ├── breakingnews.png │ │ │ ├── fleetio.png │ │ │ ├── gathercontent.png │ │ │ ├── jshint.png │ │ │ ├── kippt.png │ │ │ └── soundready.png │ │ ├── examples │ │ │ ├── bootstrap-example-carousel.png │ │ │ ├── bootstrap-example-fluid.png │ │ │ ├── bootstrap-example-justified-nav.png │ │ │ ├── bootstrap-example-marketing-narrow.png │ │ │ ├── bootstrap-example-marketing.png │ │ │ ├── bootstrap-example-signin.png │ │ │ ├── bootstrap-example-starter.png │ │ │ ├── bootstrap-example-sticky-footer.png │ │ │ ├── browser-icon-chrome.png │ │ │ ├── browser-icon-firefox.png │ │ │ ├── browser-icon-safari.png │ │ │ ├── slide-01.jpg │ │ │ ├── slide-02.jpg │ │ │ └── slide-03.jpg │ │ ├── glyphicons-halflings-white.png │ │ ├── glyphicons-halflings.png │ │ ├── grid-baseline-20px.png │ │ ├── less-logo-large.png │ │ ├── responsive-illustrations.png │ │ └── view-source www.eyecon.ro bootstrap-datepicker .html │ │ ├── js │ │ ├── README.md │ │ ├── application.js │ │ ├── bootstrap-datepicker.js │ │ ├── html5shiv.js │ │ └── jquery.min.js │ │ └── less │ │ └── datepicker.less └── test │ ├── java │ ├── features │ │ ├── CucumberFeatures.java │ │ └── steps │ │ │ ├── APISteps.java │ │ │ ├── DataCustodianSteps.java │ │ │ ├── IntegrationSteps.java │ │ │ ├── RetailCustomerSteps.java │ │ │ ├── SharedSteps.java │ │ │ ├── StepUtils.java │ │ │ └── UsagePointSteps.java │ └── org │ │ └── greenbuttonalliance │ │ └── espi │ │ └── datacustodian │ │ ├── BaseTest.java │ │ ├── console │ │ └── ImportUsagePointTests.java │ │ ├── domain │ │ ├── BatchListMarshallerTest.java │ │ ├── IdentifiedObjectTests.java │ │ ├── MeterReadingTests.java │ │ ├── UsagePointTests.java │ │ └── XMLTest.java │ │ ├── integration │ │ ├── HomeTests.java │ │ ├── ImportDBTest.java │ │ ├── SeedDataGeneratorTest.java │ │ ├── utils │ │ │ └── ATOMContentHandlerTests.java │ │ └── web │ │ │ └── filters │ │ │ └── CORSFilterTests.java │ │ ├── mocks │ │ └── MockConsumerTokenServices.java │ │ ├── models │ │ └── atom │ │ │ └── EntryTypeTests.java │ │ ├── oauth │ │ └── EspiTokenEnhancerTests.java │ │ ├── repositories │ │ └── jpa │ │ │ └── MeterReadingRepositoryImplTests.java │ │ ├── support │ │ └── TestUtils.java │ │ ├── utils │ │ └── factories │ │ │ ├── EspiFactory.java │ │ │ └── FixtureFactory.java │ │ └── web │ │ ├── DefaultControllerTest.java │ │ ├── ExportFilterTests.java │ │ ├── HomeControllerTests.java │ │ ├── LoginControllerTests.java │ │ ├── api │ │ └── ExportServiceTests.java │ │ ├── custodian │ │ ├── AssociateUsagePointControllerTests.java │ │ ├── CustodianHomeControllerTests.java │ │ ├── RetailCustomerUsagePointControllerTests.java │ │ └── UploadControllerTests.java │ │ ├── customer │ │ ├── CustomerHomeControllerTests.java │ │ ├── MeterReadingControllerTest.java │ │ ├── ScopeSelectionControllerTests.java │ │ └── UsagePointControllerTests.java │ │ └── filter │ │ └── CORSFilterTests.java │ └── resources │ ├── cucumber.xml │ ├── features │ ├── API.feature │ ├── Authentication.feature │ ├── DataCustodian.feature │ ├── ImportUsagePoint.feature │ ├── Integration.feature │ └── RetailCustomers.feature │ ├── fixtures │ ├── ServiceCategory.xml │ ├── test_usage_data.xml │ └── usage_point.xml │ ├── log4j.properties │ └── spring │ ├── test-context.xml │ └── test-service-context.xml └── system.properties /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Java Maven CircleCI 2.0 configuration file 2 | # 3 | # Check https://circleci.com/docs/2.0/language-java/ for more details 4 | # 5 | version: 2 6 | jobs: 7 | build: 8 | docker: 9 | # specify the version you desire here 10 | - image: circleci/openjdk:8-jdk 11 | 12 | # Specify service dependencies here if necessary 13 | # CircleCI maintains a library of pre-built images 14 | # documented at https://circleci.com/docs/2.0/circleci-images/ 15 | # - image: circleci/postgres:9.4 16 | working_directory: ~/repo 17 | 18 | environment: 19 | # Customize the JVM maximum heap limit 20 | MAVEN_OPTS: -Xmx3200m 21 | 22 | steps: 23 | - checkout 24 | 25 | # Download and cache dependencies 26 | - restore_cache: 27 | keys: 28 | - v1-dependencies-{{ checksum "pom.xml" }} 29 | # fallback to using the latest cache if no exact match is found 30 | - v1-dependencies- 31 | 32 | # Install deps for Circle 33 | # TODO -- Remove maven.test.skip=true after Test issues have been resolved 34 | - run: mvn install -Dmaven.test.skip=true 35 | - run: mvn dependency:go-offline 36 | 37 | - save_cache: 38 | paths: 39 | - ~/.m2 40 | key: v1-dependencies-{{ checksum "pom.xml" }} 41 | 42 | # run tests! 43 | # 44 | # TODO -- Reactivate after Integration Test issues have been resolved 45 | #- run: mvn integration-test 46 | 47 | - run: mvn sonar:sonar -Dsonar.projectKey=GreenButtonAlliance_OpenESPI-DataCustodian-java -Dsonar.organization=greenbuttonalliance -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=2ddd7468eede6ec7c1846bf610c2699d9f81b87d 48 | -------------------------------------------------------------------------------- /.circleci/settings.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | 23 | 24 | 25 | ossrh 26 | DonaldCGBA 27 | ${env.OSSRH_PWD} 28 | 29 | 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###################### 2 | # Project Specific 3 | ###################### 4 | /build/www/** 5 | /src/test/javascript/coverage/ 6 | /src/test/javascript/PhantomJS*/ 7 | 8 | ###################### 9 | # Node 10 | ###################### 11 | /node/ 12 | node_tmp/ 13 | node_modules/ 14 | npm-debug.log.* 15 | 16 | ###################### 17 | # SASS 18 | ###################### 19 | .sass-cache/ 20 | 21 | ###################### 22 | # Eclipse 23 | ###################### 24 | *.pydevproject 25 | .project 26 | .metadata 27 | tmp/ 28 | tmp/**/* 29 | *.tmp 30 | *.bak 31 | *.swp 32 | *~.nib 33 | local.properties 34 | .classpath 35 | .settings/ 36 | .loadpath 37 | .factorypath 38 | /src/main/resources/rebel.xml 39 | 40 | # External tool builders 41 | .externalToolBuilders/** 42 | 43 | # Locally stored "Eclipse launch configurations" 44 | *.launch 45 | 46 | # CDT-specific 47 | .cproject 48 | 49 | # PDT-specific 50 | .buildpath 51 | 52 | ###################### 53 | # Intellij 54 | ###################### 55 | .idea/ 56 | *.iml 57 | *.iws 58 | *.ipr 59 | *.ids 60 | *.orig 61 | 62 | ###################### 63 | # Visual Studio Code 64 | ###################### 65 | .vscode/ 66 | 67 | ###################### 68 | # Maven 69 | ###################### 70 | /log/ 71 | /target/ 72 | 73 | ###################### 74 | # Gradle 75 | ###################### 76 | .gradle/ 77 | /build/ 78 | 79 | ###################### 80 | # Package Files 81 | ###################### 82 | *.jar 83 | *.war 84 | *.ear 85 | *.db 86 | 87 | ###################### 88 | # Windows 89 | ###################### 90 | # Windows image file caches 91 | Thumbs.db 92 | 93 | # Folder config file 94 | Desktop.ini 95 | 96 | ###################### 97 | # Mac OSX 98 | ###################### 99 | .DS_Store 100 | .svn 101 | 102 | # Thumbnails 103 | ._* 104 | 105 | # Files that might appear on external disk 106 | .Spotlight-V100 107 | .Trashes 108 | 109 | ###################### 110 | # Directories 111 | ###################### 112 | /bin/ 113 | /deploy/ 114 | 115 | ###################### 116 | # Logs 117 | ###################### 118 | *.log 119 | 120 | ###################### 121 | # Others 122 | ###################### 123 | *.class 124 | *.*~ 125 | *~ 126 | .merge_file* 127 | 128 | ###################### 129 | # Gradle Wrapper 130 | ###################### 131 | !gradle/wrapper/gradle-wrapper.jar 132 | 133 | ###################### 134 | # Maven Wrapper 135 | ###################### 136 | !.mvn/wrapper/maven-wrapper.jar 137 | 138 | ###################### 139 | # ESLint 140 | ###################### 141 | .eslintcache 142 | 143 | ###################### 144 | # attach_pid 145 | ###################### 146 | .attach_pid* 147 | 148 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --path /DataCustodian --port $PORT target/*.war 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![CircleCI](https://circleci.com/gh/GreenButtonAlliance/OpenESPI-DataCustodian-java/tree/master.svg?style=svg)](https://circleci.com/gh/GreenButtonAlliance/OpenESPI-DataCustodian-java/tree/master) 2 | [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GreenButtonAlliance_OpenESPI-DataCustodian-java&metric=alert_status)](https://sonarcloud.io/dashboard?id=GreenButtonAlliance_OpenESPI-DataCustodian-java) 3 | 4 | 5 | # OpenESPI-DataCustodian 6 | 7 | The Open Energy Services Provider Interface (ESPI) Data Custodian Repository Providing implementations of the interface used to provide energy usage information to retail customers and third parties. 8 | 9 | An operational sandbox with these services operating may be found at: 10 | sandbox.greenbuttonalliance.org:8443/DataCustodian 11 | 12 | ## Setup 13 | 14 | Note: You need to download and install [OpenESPI-Common-java](https://github.com/GreenButtonAlliance/OpenESPI-Common-java) into your local Maven repository to build this project. 15 | 16 | First clone the project from github: 17 | 18 | ```bash 19 | git clone https://github.com/GreenButtonAlliance/OpenESPI-DataCustodian-java.git 20 | cd OpenESPI-DataCustodian/ 21 | ``` 22 | 23 | 24 | Build and start tomcat7 using maven (note: you must have first built the OpenESPI-Common-java jar): 25 | 26 | ```bash 27 | mvn tomcat7:run 28 | ``` 29 | 30 | Now the application should be available at [http://localhost:8080/retailcustomers](http://localhost:8080/DataCustodian). 31 | 32 | ## Building 33 | ```bash 34 | # for the default test profile 35 | mvn clean install 36 | 37 | # or for a specific profile 38 | mvn -P -Dmaven.test.skip=true clean install 39 | ``` 40 | 41 | ## IDE Setup 42 | 43 | ### Eclipse Setup 44 | 45 | Open Eclipse and import a Maven project (File > Import... > Maven > Existing Maven Projects). 46 | 47 | ### Spring Tool Suite Setup 48 | 49 | Open Spring Tool Suite and import a Maven project (File > Import... > Maven > Existing Maven Projects). 50 | To Run from within STS: 51 | 52 | right click on project and select RunOnServer 53 | 54 | 55 | To run the DC and/or the TP: 56 | 57 | do a maven build and install accordingly. Then the WAR files will be in the right position. 58 | 59 | To Start server: 60 | 61 | ```bash 62 | sudo /home/bitnami/springsource/vfabric-tc-server-developer-2.9.3.RELEASE/base-instance/bin/tcruntime-ctl.sh start 63 | ``` 64 | To Stop server: 65 | 66 | ```bash 67 | sudo /home/bitnami/springsource/vfabric-tc-server-developer-2.9.3.RELEASE/base-instance/bin/tcruntime-ctl.sh stop 68 | ``` 69 | 70 | ### IntelliJ Setup 71 | 72 | Open IntelliJ and open the project (File > Open...). 73 | 74 | ## Testing 75 | 76 | ### Unit Tests 77 | 78 | To run all Unit tests: 79 | 80 | ```bash 81 | mvn test 82 | ``` 83 | 84 | Run a single test class: 85 | 86 | ```bash 87 | mvn -Dtest= test 88 | mvn -Dtest=HomeControllerTests test 89 | ``` 90 | 91 | Run a single test in a single class: 92 | 93 | ```bash 94 | mvn -Dtest=# testMethodName 95 | mvn -Dtest=HomeControllerTests#index_shouldDisplayHomePage test 96 | ``` 97 | 98 | ### Cucumber Features 99 | 100 | To run all Cucumber features: 101 | 102 | ```bash 103 | mvn verify 104 | ``` 105 | -------------------------------------------------------------------------------- /bin/import_usage_point.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | mvn -q exec:java -Dexec.mainClass=ImportUsagePoint -Dexec.args="$1 $2" 23 | -------------------------------------------------------------------------------- /bin/install_common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | git clone https://github.com/GreenButtonAlliance/OpenESPI-Common-java.git common 23 | cd common 24 | mvn clean -DskipTests=true package 25 | cd .. 26 | -------------------------------------------------------------------------------- /bin/load_mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | echo "\. src/main/resources/db/mysql/initDB.sql" | mysql -u root -p datacustodian 23 | -------------------------------------------------------------------------------- /bin/load_psql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | createdb datacustodian 23 | wait $! 24 | psql datacustodian -f "src/main/resources/db/postgres/initDB.sql" 25 | -------------------------------------------------------------------------------- /bin/run_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | mvn -DskipTests=true clean 23 | -------------------------------------------------------------------------------- /bin/update_notice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | cd ../ 23 | mvn notice:generate -------------------------------------------------------------------------------- /bin/update_relish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # 4 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | # 6 | # Portions (c) 2013-2018 EnergyOS.org 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | # 21 | 22 | relish push greenbutton/OpenESPI-DataCustodian-java path ./src/test/resources/features -------------------------------------------------------------------------------- /etc/DataCustodianDatabaseSchema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/etc/DataCustodianDatabaseSchema.png -------------------------------------------------------------------------------- /etc/NOTICE.template: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018-2021 Green Button Alliance, Inc. 2 | 3 | Portions (c) 2013-2018 EnergyOS.org 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | 17 | This project includes: 18 | #GENERATED_NOTICES# 19 | -------------------------------------------------------------------------------- /etc/OAuthTokenstore.mwb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/etc/OAuthTokenstore.mwb -------------------------------------------------------------------------------- /etc/license-mappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | jstl 25 | jstl 26 | COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.1 27 | 28 | 29 | org.energyos 30 | DataCustodian 31 | Apache License, Version 2.0 32 | 33 | 34 | BrandsEye 35 | CORSFilter 36 | Apache License, Version 2.0 37 | 38 | 39 | -------------------------------------------------------------------------------- /settings-example.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | TomcatServerDeployment 31 | (Tomcat UserID) 32 | {Tomcat Password} 33 | 34 | 35 | packagecloud.release 36 | {packagecloud API Token} 37 | 38 | 39 | packagecloud.snapshot 40 | {packagecloud API Token} 41 | 42 | 43 | nexus-snapshot 44 | {Nexus UserID} 45 | {Nexus Password} 46 | 47 | 48 | nexus-release 49 | {Nexus UserID} 50 | {Nexus Password} 51 | 52 | 53 | sonatype-snapshot 54 | {Sonatype UserID 55 | {Sonatype Password 56 | 57 | 58 | sonatype-release 59 | {Sonatype UserID 60 | {Sonatype Password 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /settings.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | TomcatServerDeployment 33 | bitnami 34 | password 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/atom/EspiEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.atom; 22 | 23 | import com.sun.syndication.feed.atom.Content; 24 | import com.sun.syndication.feed.atom.Entry; 25 | import com.sun.syndication.feed.atom.Link; 26 | import com.sun.syndication.io.FeedException; 27 | import org.greenbuttonalliance.espi.common.domain.IdentifiedObject; 28 | import org.greenbuttonalliance.espi.common.utils.EspiMarshaller; 29 | 30 | import java.util.ArrayList; 31 | import java.util.List; 32 | 33 | // TODO: Validate that EspiEntry is used within the implementation 34 | public abstract class EspiEntry extends Entry { 35 | /** 36 | * 37 | */ 38 | private static final long serialVersionUID = 1L; 39 | private Link selfLink = new Link(); 40 | private Link upLink = new Link(); 41 | private List relatedLinks = new ArrayList<>(); 42 | 43 | protected T espiObject; 44 | 45 | @SuppressWarnings("unchecked") 46 | public EspiEntry(T espiObject) throws FeedException { 47 | this.espiObject = espiObject; 48 | this.setTitle(espiObject.getDescription()); 49 | this.setId(espiObject.getMRID()); 50 | this.setPublished(espiObject.getPublished().getTime()); 51 | this.setUpdated(espiObject.getUpdated().getTime()); 52 | 53 | selfLink.setRel("self"); 54 | selfLink.setHref(getSelfHref()); 55 | upLink.setRel("up"); 56 | upLink.setHref(getUpHref()); 57 | 58 | getOtherLinks().add(selfLink); 59 | getOtherLinks().add(upLink); 60 | 61 | buildRelatedLinks(); 62 | 63 | Content content = new Content(); 64 | content.setValue(EspiMarshaller.marshal(espiObject)); 65 | this.getContents().add(content); 66 | } 67 | 68 | protected abstract String getSelfHref(); 69 | 70 | protected abstract String getUpHref(); 71 | 72 | protected abstract void buildRelatedLinks(); 73 | 74 | public Link getSelfLink() { 75 | return selfLink; 76 | } 77 | 78 | public Link getUpLink() { 79 | return upLink; 80 | } 81 | 82 | public List getRelatedLinks() { 83 | return relatedLinks; 84 | } 85 | 86 | @SuppressWarnings("unchecked") 87 | protected void addRelatedLink(String href) { 88 | Link link = new Link(); 89 | link.setRel("related"); 90 | link.setHref(href); 91 | 92 | relatedLinks.add(link); 93 | getOtherLinks().add(link); 94 | } 95 | 96 | protected void setUpLinkHref(String href) { 97 | getUpLink().setHref(href); 98 | } 99 | 100 | protected void setSelfLinkHref(String href) { 101 | getSelfLink().setHref(href); 102 | } 103 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/console/ImportUsagePoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.console; 22 | 23 | import org.apache.http.HttpVersion; 24 | import org.apache.http.client.HttpClient; 25 | import org.apache.http.client.methods.HttpPost; 26 | import org.apache.http.entity.mime.HttpMultipartMode; 27 | import org.apache.http.entity.mime.MultipartEntity; 28 | import org.apache.http.entity.mime.content.FileBody; 29 | import org.apache.http.impl.client.DefaultHttpClient; 30 | import org.apache.http.params.CoreProtocolPNames; 31 | 32 | import java.io.File; 33 | import java.io.IOException; 34 | 35 | public class ImportUsagePoint { 36 | 37 | public static void upload(String filename, String url, HttpClient client) throws IOException { 38 | HttpPost post = new HttpPost(url); 39 | MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); 40 | 41 | File file = new File(filename); 42 | entity.addPart("file", new FileBody(((File) file), "application/rss+xml")); 43 | 44 | post.setEntity(entity); 45 | 46 | client.execute(post); 47 | } 48 | 49 | public static void main(String[] args) { 50 | if (args.length == 2) { 51 | try { 52 | String filename = args[0]; 53 | String url = args[1]; 54 | 55 | DefaultHttpClient client = new DefaultHttpClient(); 56 | client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); 57 | upload(filename, url, client); 58 | client.getConnectionManager().shutdown(); 59 | } catch (IOException e) { 60 | e.printStackTrace(); 61 | } 62 | } else { 63 | System.out.println("Usage: import_usage_point.sh filename url"); 64 | System.out.println(""); 65 | System.out.println("Example:"); 66 | System.out.println(""); 67 | System.out.println(" import_usage_point.sh etc/usage_point.xml http://localhost:8080/custodian/retailcustomers/1/upload"); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/service/UpdateService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.service; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.BatchList; 24 | import org.greenbuttonalliance.espi.common.domain.Subscription; 25 | 26 | public interface UpdateService { 27 | BatchList updatedResources(Subscription subscription); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/service/impl/UpdateServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.service.impl; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.BatchList; 24 | import org.greenbuttonalliance.espi.common.domain.Subscription; 25 | import org.greenbuttonalliance.espi.common.domain.UsagePoint; 26 | import org.greenbuttonalliance.espi.common.service.UsagePointService; 27 | import org.greenbuttonalliance.espi.datacustodian.service.UpdateService; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.stereotype.Service; 30 | 31 | import java.util.List; 32 | 33 | @Service 34 | public class UpdateServiceImpl implements UpdateService { 35 | 36 | @Autowired 37 | private UsagePointService usagePointService; 38 | 39 | public BatchList updatedResources(Subscription subscription) { 40 | List usagePoints = usagePointService 41 | .findAllUpdatedFor(subscription); 42 | 43 | BatchList batchList = new BatchList(); 44 | 45 | for (UsagePoint usagePoint : usagePoints) { 46 | batchList.getResources().add(usagePoint.getSelfHref()); 47 | } 48 | 49 | return batchList; 50 | } 51 | 52 | public void setUsagePointService(UsagePointService usagePointService) { 53 | this.usagePointService = usagePointService; 54 | } 55 | 56 | public UsagePointService getUsagePointService() { 57 | return this.usagePointService; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/utils/URLHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.utils; 22 | 23 | import java.util.Set; 24 | 25 | public class URLHelper { 26 | 27 | public static String newScopeParams(String[] scopes) { 28 | StringBuilder sb = new StringBuilder(); 29 | for (int i = 0; i < scopes.length; i++) { 30 | if (i > 0) 31 | sb.append("&"); 32 | sb.append("scope=" + scopes[i]); 33 | } 34 | return sb.toString(); 35 | } 36 | 37 | public static String newScopeParams(Set scopes) { 38 | StringBuilder sb = new StringBuilder(); 39 | int i = 0; 40 | for (String scope : scopes) { 41 | if (i > 0) 42 | sb.append("&"); 43 | sb.append("scope=" + scope); 44 | i++; 45 | } 46 | return sb.toString(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/BaseController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.RetailCustomer; 24 | import org.springframework.security.core.Authentication; 25 | import org.springframework.web.bind.annotation.ModelAttribute; 26 | 27 | import java.security.Principal; 28 | 29 | public class BaseController { 30 | @ModelAttribute("currentCustomer") 31 | public RetailCustomer currentCustomer(Principal principal) { 32 | try { 33 | System.out.printf("BaseController: currentCustomer -- %s\n", 34 | (RetailCustomer) ((Authentication) principal) 35 | .getPrincipal()); 36 | return (RetailCustomer) ((Authentication) principal).getPrincipal(); 37 | } catch (Exception e) { 38 | System.out.printf("BaseController: currentCustomer -- null\n"); 39 | return null; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/DefaultController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.RetailCustomer; 24 | import org.greenbuttonalliance.espi.common.domain.Routes; 25 | import org.springframework.stereotype.Controller; 26 | import org.springframework.web.bind.annotation.RequestMapping; 27 | 28 | import javax.servlet.http.HttpServletRequest; 29 | import java.security.Principal; 30 | 31 | @Controller 32 | public class DefaultController extends BaseController { 33 | 34 | @RequestMapping(Routes.DEFAULT) 35 | public String defaultAfterLogin(HttpServletRequest request, 36 | Principal principal) { 37 | if (request.isUserInRole(RetailCustomer.ROLE_CUSTODIAN)) { 38 | return "redirect:/custodian/home"; 39 | } else if (request.isUserInRole(RetailCustomer.ROLE_USER)) { 40 | return "redirect:/RetailCustomer/" 41 | + currentCustomer(principal).getId() + "/home"; 42 | } 43 | return "redirect:/home"; 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/HomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.Routes; 24 | import org.springframework.stereotype.Controller; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RequestMethod; 27 | 28 | @Controller 29 | public class HomeController extends BaseController { 30 | 31 | @RequestMapping(value = Routes.ROOT, method = RequestMethod.GET) 32 | public String index() { 33 | return "/home"; 34 | } 35 | 36 | @RequestMapping(value = Routes.HOME, method = RequestMethod.GET) 37 | public String home() { 38 | return "/home"; 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/LoginController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.Routes; 24 | import org.springframework.stereotype.Controller; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RequestMethod; 27 | 28 | @Controller 29 | @RequestMapping(Routes.LOGIN) 30 | public class LoginController { 31 | 32 | @RequestMapping(method = RequestMethod.GET) 33 | public String index() { 34 | return "login"; 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/VersionRESTController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.springframework.stereotype.Controller; 24 | import org.springframework.ui.ModelMap; 25 | import org.springframework.web.bind.annotation.RequestMapping; 26 | import org.springframework.web.bind.annotation.RequestMethod; 27 | 28 | import javax.servlet.ServletContext; 29 | import javax.servlet.http.HttpServletRequest; 30 | import java.io.IOException; 31 | import java.io.InputStream; 32 | import java.util.HashMap; 33 | import java.util.Map; 34 | import java.util.jar.Manifest; 35 | 36 | @Controller 37 | @RequestMapping 38 | public class VersionRESTController extends BaseController { 39 | 40 | /** 41 | * Handling GET request to retrieve details from MANIFEST.MF file 42 | * 43 | * @param request 44 | * HTTP Servlet Request 45 | * @param model 46 | * ModelMap data 47 | * @throws IOException 48 | * Exception thrown by failed or interrupted I/O operations. 49 | * 50 | * @return implementation details 51 | */ 52 | @RequestMapping(value = "/about-version", method = RequestMethod.GET) 53 | public String getBuildNumber(HttpServletRequest request, ModelMap model) 54 | throws IOException { 55 | 56 | ServletContext context = request.getSession().getServletContext(); 57 | InputStream manifestStream = context 58 | .getResourceAsStream("/META-INF/MANIFEST.MF"); 59 | Manifest manifest = new Manifest(manifestStream); 60 | 61 | Map aboutInfo = new HashMap<>(); 62 | aboutInfo.put("Implementation-Vendor", manifest.getMainAttributes() 63 | .getValue("Implementation-Vendor")); 64 | aboutInfo.put("Implementation-Title", manifest.getMainAttributes() 65 | .getValue("Implementation-Title")); 66 | aboutInfo.put("Implementation-Version", manifest.getMainAttributes() 67 | .getValue("Implementation-Version")); 68 | aboutInfo.put("Implementation-Jdk", manifest.getMainAttributes() 69 | .getValue("Build-Jdk")); 70 | aboutInfo.put("Implementation-Build", manifest.getMainAttributes() 71 | .getValue("Implementation-Build")); 72 | aboutInfo.put("Implementation-Build-Time", manifest.getMainAttributes() 73 | .getValue("Implementation-Build-Time")); 74 | 75 | model.put("aboutInfo", aboutInfo); 76 | return "/about"; 77 | 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/custodian/CustodianHomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.custodian; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.Routes; 24 | import org.greenbuttonalliance.espi.datacustodian.web.BaseController; 25 | import org.springframework.stereotype.Controller; 26 | import org.springframework.web.bind.annotation.RequestMapping; 27 | import org.springframework.web.bind.annotation.RequestMethod; 28 | 29 | @Controller 30 | @RequestMapping(Routes.DATA_CUSTODIAN_HOME) 31 | public class CustodianHomeController extends BaseController { 32 | 33 | @RequestMapping(method = RequestMethod.GET) 34 | public String index() { 35 | return Routes.DATA_CUSTODIAN_HOME; 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/custodian/ManagementController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.custodian; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.Routes; 24 | import org.greenbuttonalliance.espi.common.service.NotificationService; 25 | import org.greenbuttonalliance.espi.datacustodian.web.BaseController; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.security.access.prepost.PreAuthorize; 28 | import org.springframework.stereotype.Controller; 29 | import org.springframework.ui.ModelMap; 30 | import org.springframework.web.bind.annotation.PathVariable; 31 | import org.springframework.web.bind.annotation.RequestMapping; 32 | import org.springframework.web.bind.annotation.RequestMethod; 33 | 34 | @Controller 35 | @PreAuthorize("hasRole('ROLE_CUSTODIAN')") 36 | public class ManagementController extends BaseController { 37 | 38 | @Autowired 39 | private NotificationService notificationService; 40 | 41 | @RequestMapping(value = Routes.DATA_CUSTODIAN_NOTIFY_THIRD_PARTY, method = RequestMethod.GET) 42 | public String notifyThirdParty(@PathVariable Long applicationInformationId, 43 | ModelMap model) throws Exception { 44 | 45 | notificationService.notifyAllNeed(); 46 | 47 | return "redirect:" + Routes.DATA_CUSTODIAN_HOME; 48 | } 49 | 50 | @RequestMapping(value = Routes.DATA_CUSTODIAN_NOTIFY_THIRD_PARTYS, method = RequestMethod.GET) 51 | public String notifyThirdParty(ModelMap model) throws Exception { 52 | 53 | notificationService.notifyAllNeed(); 54 | 55 | return "redirect:" + Routes.DATA_CUSTODIAN_HOME; 56 | } 57 | 58 | public void setNotificationService(NotificationService notificationService) { 59 | this.notificationService = notificationService; 60 | } 61 | 62 | public NotificationService getNotificationService() { 63 | return this.notificationService; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/custodian/UploadForm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.custodian; 22 | 23 | import org.springframework.web.multipart.MultipartFile; 24 | 25 | public class UploadForm { 26 | private MultipartFile file; 27 | 28 | public MultipartFile getFile() { 29 | return file; 30 | } 31 | 32 | public void setFile(MultipartFile file) { 33 | this.file = file; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/customer/CustomerHomeController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.Routes; 24 | import org.greenbuttonalliance.espi.datacustodian.web.BaseController; 25 | import org.springframework.stereotype.Controller; 26 | import org.springframework.web.bind.annotation.RequestMapping; 27 | import org.springframework.web.bind.annotation.RequestMethod; 28 | 29 | @Controller 30 | @RequestMapping(Routes.RETAIL_CUSTOMER_HOME) 31 | public class CustomerHomeController extends BaseController { 32 | 33 | @RequestMapping(method = RequestMethod.GET) 34 | public String index() { 35 | return "/customer/home"; 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/customer/ScopeSelectionController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | 22 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 23 | 24 | import org.greenbuttonalliance.espi.common.domain.ApplicationInformation; 25 | import org.greenbuttonalliance.espi.common.domain.Routes; 26 | import org.greenbuttonalliance.espi.common.service.ApplicationInformationService; 27 | import org.greenbuttonalliance.espi.datacustodian.web.BaseController; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.dao.EmptyResultDataAccessException; 30 | import org.springframework.http.HttpStatus; 31 | import org.springframework.security.access.prepost.PreAuthorize; 32 | import org.springframework.stereotype.Controller; 33 | import org.springframework.web.bind.annotation.*; 34 | 35 | import javax.persistence.NoResultException; 36 | import javax.servlet.http.HttpServletRequest; 37 | 38 | import static org.greenbuttonalliance.espi.datacustodian.utils.URLHelper.newScopeParams; 39 | 40 | @Controller 41 | @PreAuthorize("hasRole('ROLE_USER')") 42 | public class ScopeSelectionController extends BaseController { 43 | 44 | @Autowired 45 | private ApplicationInformationService applicationInformationService; 46 | 47 | @ExceptionHandler(Exception.class) 48 | @ResponseStatus(value = HttpStatus.FORBIDDEN, reason = "Access Not Authorized") 49 | public void handleGenericException() { 50 | } 51 | 52 | @RequestMapping(value = Routes.DATA_CUSTODIAN_SCOPE_SELECTION_SCREEN, method = RequestMethod.GET) 53 | public String scopeSelection(HttpServletRequest request, String[] scopes, 54 | @RequestParam("ThirdPartyID") String thirdPartyClientId) 55 | throws Exception { 56 | 57 | try { 58 | ApplicationInformation applicationInformation = applicationInformationService 59 | .findByClientId(thirdPartyClientId); 60 | 61 | return "redirect:" 62 | + applicationInformation 63 | .getThirdPartyScopeSelectionScreenURI() + "?" 64 | + newScopeParams(applicationInformation.getScope()) 65 | + "&DataCustodianID=" 66 | + applicationInformation.getDataCustodianId(); 67 | } catch (NoResultException | EmptyResultDataAccessException e) { 68 | System.out.printf( 69 | "ScopeSelectionController: ApplicationInformation record not found! " 70 | + "ThirdPartyID = %s\n", thirdPartyClientId); 71 | throw new Exception("Access Not Authorized"); 72 | } 73 | } 74 | 75 | public void setApplicationInformationService( 76 | ApplicationInformationService applicationInformationService) { 77 | this.applicationInformationService = applicationInformationService; 78 | } 79 | } -------------------------------------------------------------------------------- /src/main/java/org/greenbuttonalliance/espi/datacustodian/web/customer/ThirdPartyController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.ApplicationInformation; 24 | import org.greenbuttonalliance.espi.common.domain.Routes; 25 | import org.greenbuttonalliance.espi.common.service.ApplicationInformationService; 26 | import org.greenbuttonalliance.espi.common.service.ResourceService; 27 | import org.greenbuttonalliance.espi.datacustodian.utils.URLHelper; 28 | import org.greenbuttonalliance.espi.datacustodian.web.BaseController; 29 | import org.springframework.beans.factory.annotation.Autowired; 30 | import org.springframework.stereotype.Controller; 31 | import org.springframework.ui.ModelMap; 32 | import org.springframework.web.bind.annotation.RequestMapping; 33 | import org.springframework.web.bind.annotation.RequestMethod; 34 | import org.springframework.web.bind.annotation.RequestParam; 35 | 36 | @Controller 37 | @RequestMapping(Routes.THIRD_PARTY_LIST) 38 | public class ThirdPartyController extends BaseController { 39 | 40 | @Autowired 41 | private ApplicationInformationService applicationInformationService; 42 | 43 | @Autowired 44 | private ResourceService resourceService; 45 | 46 | @RequestMapping(method = RequestMethod.GET) 47 | public String index(ModelMap model) { 48 | // note that we are only looking at "THIRD_PARTY" relationships here. 49 | model.put("applicationInformationList", 50 | applicationInformationService.findByKind("THIRD_PARTY")); 51 | return "/customer/thirdparties/index"; 52 | } 53 | 54 | @RequestMapping(method = RequestMethod.POST) 55 | public String selectThirdParty( 56 | @RequestParam("Third_party") Long thirdPartyId, 57 | @RequestParam("Third_party_URL") String thirdPartyURL) { 58 | ApplicationInformation applicationInformation = resourceService 59 | .findById(thirdPartyId, ApplicationInformation.class); 60 | return "redirect:" + thirdPartyURL + "?" 61 | + URLHelper.newScopeParams(applicationInformation.getScope()) 62 | + "&DataCustodianID=" 63 | + applicationInformation.getDataCustodianId(); 64 | } 65 | 66 | public void setApplicationInformationService( 67 | ApplicationInformationService applicationInformationService) { 68 | this.applicationInformationService = applicationInformationService; 69 | } 70 | 71 | public ApplicationInformationService gettApplicationInformationService( 72 | ApplicationInformationService applicationInformationService) { 73 | return this.applicationInformationService; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/resources/commons-logging.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl 22 | org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | # Set root logger level to DEBUG and its only appender to A1. 22 | #log4j.rootLogger=TRACE, file, A1 23 | log4j.rootLogger=FATAL, A1 24 | #log4j.rootLogger=DEBUG,A1 25 | #log4j.rootLogger=TRACE,A1 26 | 27 | # A1 is set to be a ConsoleAppender. 28 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 29 | 30 | # A1 uses PatternLayout. 31 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 32 | log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 33 | 34 | # Direct log messages to a log file 35 | log4j.appender.file=org.apache.log4j.RollingFileAppender 36 | log4j.appender.file.File=dcloging.log 37 | log4j.appender.file.MaxFileSize=10MB 38 | log4j.appender.file.MaxBackupIndex=1 39 | log4j.appender.file.layout=org.apache.log4j.PatternLayout 40 | log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -------------------------------------------------------------------------------- /src/main/resources/simplelog.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | org.apache.commons.logging.simplelog.defaultlog=info 22 | org.apache.commons.logging.simplelog.showdatetime=true 23 | org.apache.commons.logging.simplelog.dateTimeFormat='DataCustodian' HH:mm:ss.SSS 24 | org.apache.commons.logging.simplelog.log.org.springframework.web=debug 25 | org.apache.commons.logging.simplelog.log.org.springframework.security=debug 26 | org.apache.commons.logging.simplelog.log.org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource=info 27 | -------------------------------------------------------------------------------- /src/main/resources/spring/data-config.xml: -------------------------------------------------------------------------------- 1 | 20 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/spring/datasource-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 29 | 30 | 31 | 32 | 37 | -------------------------------------------------------------------------------- /src/main/resources/spring/hsql-data-access.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | jpa.showSql=false 22 | 23 | #------------------------------------------------------------------------------- 24 | # HSQL Settings 25 | 26 | jdbc.driverClassName=org.hsqldb.jdbcDriver 27 | jdbc.url=jdbc:hsqldb:mem:datacustodian 28 | jdbc.username=sa 29 | jdbc.password= 30 | 31 | # Property that determines which database to use with an AbstractJpaVendorAdapter 32 | jpa.database=HSQL -------------------------------------------------------------------------------- /src/main/resources/spring/mysql-data-access.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | jpa.showSql=false 22 | 23 | #------------------------------------------------------------------------------- 24 | # MySQL Settings 25 | 26 | jdbc.driverClassName=com.mysql.jdbc.Driver 27 | jdbc.url=jdbc:mysql://localhost:3306/datacustodian 28 | jdbc.username=root 29 | jdbc.password=password 30 | 31 | ##Property that determines which Hibernate dialect to use 32 | ##(only applied with "applicationContext-hibernate.xml") 33 | hibernate.dialect=org.hibernate.dialect.MySQLDialect 34 | 35 | # Property that determines which database to use with an AbstractJpaVendorAdapter 36 | jpa.database=MYSQL 37 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/400.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 |

Invalid Request

24 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/403.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | <%----%> 27 | 28 | 29 | 30 | 31 | 32 |
33 |

Whoops!

34 |
35 |

You don't have permission to view the page you attempted to access.

36 |

Continue 37 | 38 | 39 | 40 |

41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/Sponsors.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 | 35 |

Sponsors

36 | 37 |

OpenESPI Open Source Development Community

38 |
39 |
EnergyOS.org
40 |
National Institute of Standards and Technology
41 |
Pivotal Labs
42 |
People Power Company
43 |
OpenCommons.org
44 |
Hypertek Inc.
45 |
REMI Networks
46 |
47 |

Green Button Sandbox

48 |
49 |
EnergyOS.org
50 |
National Institute of Standards and Technology
51 |
EnerNex
52 |
HyperTek Inc.
53 |
54 |
55 |
56 | 57 |
58 | 59 | 60 | 61 |
62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/about.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
Implementation-Vendor
Implementation-Title
Implementation-Version
Implementation-Jdk
Implementation-Build
Implementation-Build-Time
45 | 46 |
47 |
48 | 49 |
50 | 51 | 52 | 53 |
54 | 55 | 56 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/access_confirmation.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="org.springframework.security.core.AuthenticationException" %> 2 | <%@ page import="org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException" %> 3 | <%@ page import="org.springframework.security.web.WebAttributes" %> 4 | <%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags" %> 5 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 6 | <%-- 7 | ~ 8 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 9 | ~ 10 | ~ Portions (c) 2013-2018 EnergyOS.org 11 | ~ 12 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 13 | ~ you may not use this file except in compliance with the License. 14 | ~ You may obtain a copy of the License at 15 | ~ 16 | ~ http://www.apache.org/licenses/LICENSE-2.0 17 | ~ 18 | ~ Unless required by applicable law or agreed to in writing, software 19 | ~ distributed under the License is distributed on an "AS IS" BASIS, 20 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | ~ See the License for the specific language governing permissions and 22 | ~ limitations under the License. 23 | ~ 24 | --%> 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 | 40 | <% if (session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) != null && !(session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION) instanceof UnapprovedClientAuthenticationException)) { %> 41 |
42 | 43 |

Whoops!

44 | 45 |

Access could not be granted. 46 | (<%= ((AuthenticationException) session.getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION)).getMessage() %>)

47 |
48 | <% } %> 49 | 50 | 51 | 52 | 53 | 54 |

Please Confirm

55 | 56 |

You hereby authorize "" to access your protected resources.

57 | 58 |
59 | 60 |
    61 | checked checked 62 |
  • ${scope.key}: Approve Deny
  • 63 |
    64 |
65 | 68 |
69 |
70 | 71 | 72 | 73 |
74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/custodian/oauth/tokens.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 4 | <%-- 5 | ~ 6 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 7 | ~ 8 | ~ Portions (c) 2013-2018 EnergyOS.org 9 | ~ 10 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 11 | ~ you may not use this file except in compliance with the License. 12 | ~ You may obtain a copy of the License at 13 | ~ 14 | ~ http://www.apache.org/licenses/LICENSE-2.0 15 | ~ 16 | ~ Unless required by applicable law or agreed to in writing, software 17 | ~ distributed under the License is distributed on an "AS IS" BASIS, 18 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ~ See the License for the specific language governing permissions and 20 | ~ limitations under the License. 21 | ~ 22 | --%> 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 |

OAuth Token Management

38 | 39 | 40 |
41 |
42 |
43 | 44 | 45 | 46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/custodian/retailcustomers/show.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 |  Add Usage Point 35 | 36 |
37 |
38 | 39 |

40 | 41 |
42 |
43 | 44 |
45 | 46 | 47 | 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/custodian/retailcustomers/usagepoints/form.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 2 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%-- 5 | ~ 6 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 7 | ~ 8 | ~ Portions (c) 2013-2018 EnergyOS.org 9 | ~ 10 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 11 | ~ you may not use this file except in compliance with the License. 12 | ~ You may obtain a copy of the License at 13 | ~ 14 | ~ http://www.apache.org/licenses/LICENSE-2.0 15 | ~ 16 | ~ Unless required by applicable law or agreed to in writing, software 17 | ~ distributed under the License is distributed on an "AS IS" BASIS, 18 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ~ See the License for the specific language governing permissions and 20 | ~ limitations under the License. 21 | ~ 22 | --%> 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |

Add Usage Point

37 | 38 | 39 |
40 | 41 |
42 | 43 | 44 |
45 |
46 |
47 |
48 | 49 |
50 |
51 |
52 | 53 | 54 | 55 |
56 |
57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/custodian/upload.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> 4 | <%-- 5 | ~ 6 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 7 | ~ 8 | ~ Portions (c) 2013-2018 EnergyOS.org 9 | ~ 10 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 11 | ~ you may not use this file except in compliance with the License. 12 | ~ You may obtain a copy of the License at 13 | ~ 14 | ~ http://www.apache.org/licenses/LICENSE-2.0 15 | ~ 16 | ~ Unless required by applicable law or agreed to in writing, software 17 | ~ distributed under the License is distributed on an "AS IS" BASIS, 18 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ~ See the License for the specific language governing permissions and 20 | ~ limitations under the License. 21 | ~ 22 | --%> 23 | 24 | 25 | 26 | 27 | 28 | 29 | 38 | 39 | 40 | 41 | 42 |
43 |
44 |
45 |

Upload

46 | 47 | 49 | 50 | 51 |
52 | 53 |
54 | 55 | 56 |
57 |
58 |
59 |
60 |
61 |
62 | 63 | 64 | 65 |
66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/customer/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 |
36 |

Error

37 | The Following Error Occurred:

38 |

    39 |
  • ${errorString}
  • 40 |
41 |

42 | Please Contact Support at GreenButtonData for further assistance. 43 |

44 | Continue 45 |

46 | 47 |
48 | 49 | 50 | 51 |
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/customer/home.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 |
36 |

Welcome Retail Customer

37 |
38 | 39 |
40 | 41 | 42 | 43 |
44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/customer/thirdparties/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 38 | 39 | 40 | 41 |
42 | 43 |

Third Party List

44 | 45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 65 | 66 |
Third PartyURL
57 | 61 |
67 | 68 | 69 |
70 | 71 | 72 | 73 | 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/error.jsp: -------------------------------------------------------------------------------- 1 | <%@ page isErrorPage="true" import="java.io.PrintWriter"%> 2 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 |
34 |
35 |

Application Error

36 | 37 |

Please contact support.

38 | 39 |
<% exception.printStackTrace(new PrintWriter(out)); %>
40 |
41 |
42 | 43 |
44 | 45 | 46 | 47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ page isELIgnored="false" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 |
34 |
35 |
36 | 57 |
58 |
59 |
60 |
61 | 62 | 63 |
64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/oauth_error.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | DataCustodian 27 | "/> 28 | 29 | 30 | 31 | 32 |

OAuth2 Error

33 | 34 |
35 |

()

36 |

Please go back to your client application and try again, or contact the owner and ask for support

37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/retailcustomers/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
32 |
33 |
34 |

Retail Customers

35 | 36 | 37 |
${message}
38 |
39 | 40 |  Add new customer 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 61 | 64 | 65 | 66 | 67 |
UsernameFirst NameLast Name
54 | 55 | 56 | 57 | 59 | 60 | 62 | 63 |
68 |
69 |
70 | 71 |
72 | 73 | 74 | 75 |
76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/custodian/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 4 | <%-- 5 | ~ 6 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 7 | ~ 8 | ~ Portions (c) 2013-2018 EnergyOS.org 9 | ~ 10 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 11 | ~ you may not use this file except in compliance with the License. 12 | ~ You may obtain a copy of the License at 13 | ~ 14 | ~ http://www.apache.org/licenses/LICENSE-2.0 15 | ~ 16 | ~ Unless required by applicable law or agreed to in writing, software 17 | ~ distributed under the License is distributed on an "AS IS" BASIS, 18 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ~ See the License for the specific language governing permissions and 20 | ~ limitations under the License. 21 | ~ 22 | --%> 23 | 24 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/custodian/oauth/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> 4 | <%-- 5 | ~ 6 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 7 | ~ 8 | ~ Portions (c) 2013-2018 EnergyOS.org 9 | ~ 10 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 11 | ~ you may not use this file except in compliance with the License. 12 | ~ You may obtain a copy of the License at 13 | ~ 14 | ~ http://www.apache.org/licenses/LICENSE-2.0 15 | ~ 16 | ~ Unless required by applicable law or agreed to in writing, software 17 | ~ distributed under the License is distributed on an "AS IS" BASIS, 18 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | ~ See the License for the specific language governing permissions and 20 | ~ limitations under the License. 21 | ~ 22 | --%> 23 | 24 | 52 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/customer/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | <%-- 24 | e ~ 25 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 26 | ~ you may not use this file except in compliance with the License. 27 | ~ You may obtain a copy of the License at 28 | ~ 29 | ~ http://www.apache.org/licenses/LICENSE-2.0 30 | ~ 31 | ~ Unless required by applicable law or agreed to in writing, software 32 | ~ distributed under the License is distributed on an "AS IS" BASIS, 33 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 34 | ~ See the License for the specific language governing permissions and 35 | ~ limitations under the License. 36 | --%> 37 | 38 | 64 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | 40 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/head.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%-- 3 | ~ 4 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 5 | ~ 6 | ~ Portions (c) 2013-2018 EnergyOS.org 7 | ~ 8 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 9 | ~ you may not use this file except in compliance with the License. 10 | ~ You may obtain a copy of the License at 11 | ~ 12 | ~ http://www.apache.org/licenses/LICENSE-2.0 13 | ~ 14 | ~ Unless required by applicable law or agreed to in writing, software 15 | ~ distributed under the License is distributed on an "AS IS" BASIS, 16 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | ~ See the License for the specific language governing permissions and 18 | ~ limitations under the License. 19 | ~ 20 | --%> 21 | 22 | 23 | 24 | Data Custodian 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/tiles/header.jsp: -------------------------------------------------------------------------------- 1 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 2 | <%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %> 3 | <%-- 4 | ~ 5 | ~ Copyright (c) 2018-2021 Green Button Alliance, Inc. 6 | ~ 7 | ~ Portions (c) 2013-2018 EnergyOS.org 8 | ~ 9 | ~ Licensed under the Apache License, Version 2.0 (the "License"); 10 | ~ you may not use this file except in compliance with the License. 11 | ~ You may obtain a copy of the License at 12 | ~ 13 | ~ http://www.apache.org/licenses/LICENSE-2.0 14 | ~ 15 | ~ Unless required by applicable law or agreed to in writing, software 16 | ~ distributed under the License is distributed on an "AS IS" BASIS, 17 | ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | ~ See the License for the specific language governing permissions and 19 | ~ limitations under the License. 20 | ~ 21 | --%> 22 | 23 | 47 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/spring-servlet.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 31 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/webapp/images/bg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/images/bg.gif -------------------------------------------------------------------------------- /src/main/webapp/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/images/header.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/css/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | body { 22 | padding-top: 60px; 23 | padding-bottom: 40px; 24 | } 25 | 26 | .error { 27 | color: red; 28 | } 29 | 30 | .controls input { 31 | float: left; 32 | } 33 | 34 | .controls span.error { 35 | float: left; 36 | padding-left: 10px; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/webapp/resources/css/bootstrap-datetimepicker.min.css: -------------------------------------------------------------------------------- 1 | 2 | 301 Moved Permanently 3 | 4 |

301 Moved Permanently

5 |
nginx
6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/apple-touch-icon-114-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/apple-touch-icon-114-precomposed.png -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/apple-touch-icon-144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/apple-touch-icon-144-precomposed.png -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/apple-touch-icon-57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/apple-touch-icon-57-precomposed.png -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/apple-touch-icon-72-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/apple-touch-icon-72-precomposed.png -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/favicon.ico -------------------------------------------------------------------------------- /src/main/webapp/resources/ico/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/ico/favicon.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/Green_Download_265.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/Green_Download_265.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bootstrap-docs-readme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bootstrap-docs-readme.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bootstrap-mdo-sfmoma-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bootstrap-mdo-sfmoma-01.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bootstrap-mdo-sfmoma-02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bootstrap-mdo-sfmoma-02.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bootstrap-mdo-sfmoma-03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bootstrap-mdo-sfmoma-03.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bs-docs-bootstrap-features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bs-docs-bootstrap-features.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bs-docs-masthead-pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bs-docs-masthead-pattern.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bs-docs-responsive-illustrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bs-docs-responsive-illustrations.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/bs-docs-twitter-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/bs-docs-twitter-github.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/8020select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/8020select.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/adoptahydrant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/adoptahydrant.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/breakingnews.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/breakingnews.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/fleetio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/fleetio.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/gathercontent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/gathercontent.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/jshint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/jshint.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/kippt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/kippt.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/example-sites/soundready.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/example-sites/soundready.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-carousel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-carousel.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-fluid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-fluid.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-justified-nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-justified-nav.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-marketing-narrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-marketing-narrow.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-marketing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-marketing.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-signin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-signin.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-starter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-starter.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/bootstrap-example-sticky-footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/bootstrap-example-sticky-footer.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/browser-icon-chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/browser-icon-chrome.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/browser-icon-firefox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/browser-icon-firefox.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/browser-icon-safari.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/browser-icon-safari.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/slide-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/slide-01.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/slide-02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/slide-02.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/examples/slide-03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/examples/slide-03.jpg -------------------------------------------------------------------------------- /src/main/webapp/resources/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/grid-baseline-20px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/grid-baseline-20px.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/less-logo-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/less-logo-large.png -------------------------------------------------------------------------------- /src/main/webapp/resources/img/responsive-illustrations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GreenButtonAlliance/OpenESPI-DataCustodian-java/bc4317469b0f60fc31aa8342410d4393fce029c0/src/main/webapp/resources/img/responsive-illustrations.png -------------------------------------------------------------------------------- /src/main/webapp/resources/js/application.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | $(function() { 22 | $(".navbar button.btn-navbar").on("click", function() { 23 | var $nav = $(".nav-collapse"); 24 | if($nav.hasClass("in")) { 25 | $nav.css("height", "0px").removeClass("in"); 26 | } else { 27 | $nav.css("height", "auto").addClass("in"); 28 | } 29 | }); 30 | }); -------------------------------------------------------------------------------- /src/main/webapp/resources/js/html5shiv.js: -------------------------------------------------------------------------------- 1 | /* 2 | HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 3 | */ 4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); 5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; 6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| 7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); 8 | for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;ddiv { 47 | display: none; 48 | } 49 | table{ 50 | width: 100%; 51 | margin: 0; 52 | } 53 | td, 54 | th{ 55 | text-align: center; 56 | width: 20px; 57 | height: 20px; 58 | .border-radius(4px); 59 | } 60 | td { 61 | &.day:hover { 62 | background: @grayLighter; 63 | cursor: pointer; 64 | } 65 | &.day.disabled { 66 | color: @grayLighter; 67 | } 68 | &.old, 69 | &.new { 70 | color: @grayLight; 71 | } 72 | &.active, 73 | &.active:hover { 74 | .buttonBackground(@btnPrimaryBackground, spin(@btnPrimaryBackground, 20)); 75 | color: #fff; 76 | text-shadow: 0 -1px 0 rgba(0,0,0,.25); 77 | } 78 | span { 79 | display: block; 80 | width: 47px; 81 | height: 54px; 82 | line-height: 54px; 83 | float: left; 84 | margin: 2px; 85 | cursor: pointer; 86 | .border-radius(4px); 87 | &:hover { 88 | background: @grayLighter; 89 | } 90 | &.active { 91 | .buttonBackground(@btnPrimaryBackground, spin(@btnPrimaryBackground, 20)); 92 | color: #fff; 93 | text-shadow: 0 -1px 0 rgba(0,0,0,.25); 94 | } 95 | &.old { 96 | color: @grayLight; 97 | } 98 | } 99 | } 100 | 101 | th { 102 | &.switch { 103 | width: 145px; 104 | } 105 | &.next, 106 | &.prev { 107 | font-size: @baseFontSize * 1.5; 108 | } 109 | } 110 | 111 | thead tr:first-child th { 112 | cursor: pointer; 113 | &:hover{ 114 | background: @grayLighter; 115 | } 116 | } 117 | /*.dow { 118 | border-top: 1px solid #ddd !important; 119 | }*/ 120 | } 121 | .input-append, 122 | .input-prepend { 123 | &.date { 124 | .add-on i { 125 | display: block; 126 | cursor: pointer; 127 | width: 16px; 128 | height: 16px; 129 | } 130 | } 131 | } -------------------------------------------------------------------------------- /src/test/java/features/CucumberFeatures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package features; 22 | 23 | import cucumber.api.junit.Cucumber; 24 | import org.junit.runner.RunWith; 25 | 26 | @RunWith(Cucumber.class) 27 | @Cucumber.Options(features = "classpath:features/") 28 | public class CucumberFeatures { 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/BaseTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian; 22 | 23 | import org.junit.Before; 24 | import org.mockito.MockitoAnnotations; 25 | 26 | public class BaseTest { 27 | @Before 28 | public void initMocks() { 29 | MockitoAnnotations.initMocks(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/console/ImportUsagePointTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.console; 22 | 23 | import org.apache.http.client.HttpClient; 24 | import org.apache.http.client.methods.HttpUriRequest; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.springframework.test.context.ContextConfiguration; 29 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 30 | import org.springframework.test.context.web.WebAppConfiguration; 31 | 32 | import java.io.IOException; 33 | 34 | import static org.mockito.Matchers.any; 35 | import static org.mockito.Mockito.mock; 36 | import static org.mockito.Mockito.verify; 37 | 38 | @RunWith(SpringJUnit4ClassRunner.class) 39 | @WebAppConfiguration 40 | @ContextConfiguration("/spring/test-context.xml") 41 | public class ImportUsagePointTests { 42 | 43 | @Ignore 44 | @Test 45 | public void givenValidInput_postsToURL() throws IOException { 46 | HttpClient client = mock(HttpClient.class); 47 | 48 | ImportUsagePoint.upload("import.xml", "http://locahost/upload", client); 49 | 50 | verify(client).execute(any(HttpUriRequest.class)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/domain/BatchListMarshallerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.domain; 22 | 23 | import org.custommonkey.xmlunit.exceptions.XpathException; 24 | import org.greenbuttonalliance.espi.common.domain.BatchList; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.beans.factory.annotation.Qualifier; 30 | import org.springframework.oxm.jaxb.Jaxb2Marshaller; 31 | import org.springframework.test.context.ContextConfiguration; 32 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 33 | import org.springframework.test.context.web.WebAppConfiguration; 34 | import org.xml.sax.SAXException; 35 | 36 | import javax.xml.transform.stream.StreamResult; 37 | import java.io.ByteArrayOutputStream; 38 | import java.io.IOException; 39 | 40 | import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo; 41 | import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists; 42 | 43 | @RunWith(SpringJUnit4ClassRunner.class) 44 | @WebAppConfiguration 45 | @ContextConfiguration("/spring/test-context.xml") 46 | public class BatchListMarshallerTest extends XMLTest { 47 | @Autowired 48 | @Qualifier(value = "domainMarshaller") 49 | Jaxb2Marshaller jaxb2Marshaller; 50 | 51 | public String newXML() { 52 | BatchList batchList = new BatchList(); 53 | batchList.getResources().add("foo"); 54 | batchList.getResources().add("bar"); 55 | 56 | ByteArrayOutputStream os = new ByteArrayOutputStream(); 57 | jaxb2Marshaller.marshal(batchList, new StreamResult(os)); 58 | return os.toString(); 59 | } 60 | 61 | @Ignore 62 | @Test 63 | public void batchList() throws SAXException, IOException, XpathException { 64 | assertXpathExists("/espi:BatchList", newXML()); 65 | } 66 | 67 | @Ignore 68 | @Test 69 | public void resources() throws SAXException, IOException, XpathException { 70 | assertXpathEvaluatesTo("foo", "/espi:BatchList/espi:resource[1]", 71 | newXML()); 72 | assertXpathEvaluatesTo("bar", "/espi:BatchList/espi:resource[2]", 73 | newXML()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/domain/MeterReadingTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.domain; 22 | 23 | import com.sun.syndication.io.FeedException; 24 | import org.custommonkey.xmlunit.exceptions.XpathException; 25 | import org.greenbuttonalliance.espi.common.domain.MeterReading; 26 | import org.greenbuttonalliance.espi.common.domain.UsagePoint; 27 | import org.greenbuttonalliance.espi.common.utils.EspiMarshaller; 28 | import org.junit.Ignore; 29 | import org.junit.Test; 30 | import org.xml.sax.SAXException; 31 | 32 | import javax.xml.bind.JAXBException; 33 | import javax.xml.bind.annotation.XmlTransient; 34 | import java.io.IOException; 35 | 36 | import static org.custommonkey.xmlunit.XMLAssert.assertXpathExists; 37 | import static org.greenbuttonalliance.espi.datacustodian.support.TestUtils.assertAnnotationPresent; 38 | import static org.greenbuttonalliance.espi.datacustodian.utils.factories.EspiFactory.newMeterReadingWithUsagePoint; 39 | import static org.hamcrest.CoreMatchers.equalTo; 40 | import static org.junit.Assert.assertEquals; 41 | import static org.junit.Assert.assertThat; 42 | 43 | public class MeterReadingTests extends XMLTest { 44 | 45 | @Ignore 46 | @Test 47 | public void unmarshalsMeterReading() throws SAXException, IOException, 48 | XpathException, FeedException, JAXBException { 49 | final String XML_INPUT = ""; 50 | 51 | assertEquals(MeterReading.class, EspiMarshaller.unmarshal(XML_INPUT) 52 | .getValue().getClass()); 53 | } 54 | 55 | @Ignore 56 | @Test 57 | public void marshalsMeterReading() throws SAXException, IOException, 58 | XpathException, FeedException { 59 | assertXpathExists("espi:MeterReading", 60 | EspiMarshaller.marshal(newMeterReadingWithUsagePoint())); 61 | } 62 | 63 | @Test 64 | public void usagePoint_hasTransientAnnotation() { 65 | assertAnnotationPresent(MeterReading.class, "usagePoint", 66 | XmlTransient.class); 67 | } 68 | 69 | @Test 70 | public void intervalBlocks_hasTransientAnnotation() { 71 | assertAnnotationPresent(MeterReading.class, "intervalBlocks", 72 | XmlTransient.class); 73 | } 74 | 75 | @Test 76 | public void readingType_hasTransientAnnotation() { 77 | assertAnnotationPresent(MeterReading.class, "readingType", 78 | XmlTransient.class); 79 | } 80 | 81 | @Test 82 | public void setUpResource() { 83 | MeterReading meterReading = new MeterReading(); 84 | UsagePoint usagePoint = new UsagePoint(); 85 | meterReading.setUpResource(usagePoint); 86 | 87 | assertThat(meterReading.getUsagePoint(), equalTo(usagePoint)); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/domain/UsagePointTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.domain; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.UsagePoint; 24 | import org.greenbuttonalliance.espi.common.models.atom.LinkType; 25 | import org.hamcrest.Matchers; 26 | import org.junit.Test; 27 | 28 | import java.util.List; 29 | 30 | import static org.greenbuttonalliance.espi.datacustodian.utils.factories.EspiFactory.newUsagePoint; 31 | import static org.hamcrest.CoreMatchers.hasItem; 32 | import static org.hamcrest.MatcherAssert.assertThat; 33 | import static org.hamcrest.Matchers.allOf; 34 | 35 | public class UsagePointTests { 36 | 37 | @Test 38 | public void getRelatedLinks() { 39 | UsagePoint usagePoint = newUsagePoint(); 40 | LinkType electricPowerQualitySummaryLink = new LinkType(); 41 | electricPowerQualitySummaryLink.setHref(usagePoint.getSelfHref() 42 | + "/ElectricPowerQualitySummary"); 43 | electricPowerQualitySummaryLink.setRel("related"); 44 | usagePoint.getRelatedLinks().add(electricPowerQualitySummaryLink); 45 | 46 | LinkType electricPowerUsageSummaryLink = new LinkType(); 47 | electricPowerUsageSummaryLink.setHref(usagePoint.getSelfHref() 48 | + "/ElectricPowerUsageSummary"); 49 | electricPowerUsageSummaryLink.setRel("related"); 50 | usagePoint.getRelatedLinks().add(electricPowerUsageSummaryLink); 51 | 52 | LinkType meterReadingLink = new LinkType(); 53 | meterReadingLink.setHref(usagePoint.getSelfHref() 54 | + "/ElectricPowerUsageSummary"); 55 | meterReadingLink.setRel("related"); 56 | usagePoint.getRelatedLinks().add(meterReadingLink); 57 | 58 | assertThat(usagePoint.getRelatedLinks(), 59 | hasItem(electricPowerQualitySummaryLink)); 60 | assertThat(usagePoint.getRelatedLinks(), 61 | hasItem(electricPowerUsageSummaryLink)); 62 | assertThat(usagePoint.getRelatedLinks(), hasItem(meterReadingLink)); 63 | } 64 | 65 | @Test 66 | public void getRelatedLinkHrefs() throws Exception { 67 | UsagePoint usagePoint = new UsagePoint(); 68 | LinkType link1 = new LinkType(); 69 | link1.setHref("href1"); 70 | usagePoint.getRelatedLinks().add(link1); 71 | LinkType link2 = new LinkType(); 72 | link2.setHref("href2"); 73 | usagePoint.getRelatedLinks().add(link2); 74 | 75 | List relatedLinkHrefs = usagePoint.getRelatedLinkHrefs(); 76 | 77 | assertThat(relatedLinkHrefs, 78 | allOf(Matchers.hasItem("href1"), Matchers.hasItem("href2"))); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/domain/XMLTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.domain; 22 | 23 | import org.greenbuttonalliance.espi.common.test.TestUtils; 24 | import org.greenbuttonalliance.espi.datacustodian.BaseTest; 25 | import org.junit.BeforeClass; 26 | 27 | public class XMLTest extends BaseTest { 28 | 29 | @BeforeClass 30 | public static void beforeClass() { 31 | TestUtils.setupXMLUnit(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/integration/HomeTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.integration; 22 | 23 | import org.junit.Before; 24 | import org.junit.Ignore; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | import org.springframework.beans.factory.annotation.Autowired; 28 | import org.springframework.test.context.ContextConfiguration; 29 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 30 | import org.springframework.test.context.web.WebAppConfiguration; 31 | import org.springframework.test.web.servlet.MockMvc; 32 | import org.springframework.transaction.annotation.Transactional; 33 | import org.springframework.web.context.WebApplicationContext; 34 | 35 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; 36 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; 37 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; 38 | import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; 39 | 40 | @RunWith(SpringJUnit4ClassRunner.class) 41 | @WebAppConfiguration 42 | @ContextConfiguration("/spring/test-context.xml") 43 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 44 | javax.persistence.NoResultException.class, 45 | org.springframework.dao.EmptyResultDataAccessException.class }) 46 | public class HomeTests { 47 | private MockMvc mockMvc; 48 | 49 | @Autowired 50 | protected WebApplicationContext wac; 51 | 52 | @Before 53 | public void setup() { 54 | this.mockMvc = webAppContextSetup(this.wac).build(); 55 | } 56 | 57 | @Ignore 58 | @Test 59 | public void index_displaysHomeView() throws Exception { 60 | mockMvc.perform(get("/")).andExpect(status().isOk()) 61 | .andExpect(view().name("/home")); 62 | } 63 | 64 | @Ignore 65 | @Test 66 | public void home_displaysHomeView() throws Exception { 67 | mockMvc.perform(get("/home")).andExpect(status().isOk()) 68 | .andExpect(view().name("/home")); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/integration/ImportDBTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.integration; 22 | 23 | import org.greenbuttonalliance.espi.common.service.RetailCustomerService; 24 | import org.junit.Ignore; 25 | import org.junit.Test; 26 | import org.junit.runner.RunWith; 27 | import org.springframework.beans.factory.annotation.Autowired; 28 | import org.springframework.test.context.ContextConfiguration; 29 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 30 | import org.springframework.test.context.web.WebAppConfiguration; 31 | import org.springframework.transaction.annotation.Transactional; 32 | 33 | import static org.hamcrest.MatcherAssert.assertThat; 34 | import static org.hamcrest.Matchers.equalTo; 35 | 36 | @RunWith(SpringJUnit4ClassRunner.class) 37 | @WebAppConfiguration 38 | @ContextConfiguration("/spring/test-context.xml") 39 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 40 | javax.persistence.NoResultException.class, 41 | org.springframework.dao.EmptyResultDataAccessException.class }) 42 | public class ImportDBTest { 43 | @Autowired 44 | private RetailCustomerService retailCustomerService; 45 | 46 | @Ignore 47 | @Test 48 | public void populateDB() throws Exception { 49 | assertThat(retailCustomerService.findAll().size(), equalTo(8)); 50 | assertThat(retailCustomerService.findById(1L).getFirstName(), 51 | equalTo("Alan")); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/integration/SeedDataGeneratorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.integration; 22 | 23 | import org.greenbuttonalliance.espi.common.service.RetailCustomerService; 24 | import org.greenbuttonalliance.espi.common.service.UsagePointService; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.test.context.ContextConfiguration; 30 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 31 | import org.springframework.test.context.web.WebAppConfiguration; 32 | import org.springframework.transaction.annotation.Transactional; 33 | 34 | import static org.hamcrest.MatcherAssert.assertThat; 35 | import static org.hamcrest.Matchers.hasSize; 36 | 37 | @RunWith(SpringJUnit4ClassRunner.class) 38 | @WebAppConfiguration 39 | @ContextConfiguration("/spring/test-context.xml") 40 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 41 | javax.persistence.NoResultException.class, 42 | org.springframework.dao.EmptyResultDataAccessException.class }) 43 | public class SeedDataGeneratorTest { 44 | @Autowired 45 | private UsagePointService usagePointService; 46 | @Autowired 47 | private RetailCustomerService retailCustomerService; 48 | 49 | @Ignore 50 | @Test 51 | public void init() throws Exception { 52 | assertThat( 53 | usagePointService.findAllByRetailCustomer(retailCustomerService 54 | .findById(1L)), hasSize(2)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/integration/utils/ATOMContentHandlerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.integration.utils; 22 | 23 | import org.greenbuttonalliance.espi.common.service.EntryProcessorService; 24 | import org.greenbuttonalliance.espi.common.utils.ATOMContentHandler; 25 | import org.greenbuttonalliance.espi.datacustodian.BaseTest; 26 | import org.greenbuttonalliance.espi.datacustodian.utils.factories.FixtureFactory; 27 | import org.junit.Ignore; 28 | import org.junit.Test; 29 | import org.junit.runner.RunWith; 30 | import org.springframework.beans.factory.annotation.Autowired; 31 | import org.springframework.beans.factory.annotation.Qualifier; 32 | import org.springframework.oxm.jaxb.Jaxb2Marshaller; 33 | import org.springframework.test.context.ContextConfiguration; 34 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 35 | import org.springframework.test.context.web.WebAppConfiguration; 36 | import org.springframework.transaction.annotation.Transactional; 37 | import org.xml.sax.InputSource; 38 | import org.xml.sax.XMLReader; 39 | 40 | import javax.xml.bind.JAXBContext; 41 | import javax.xml.parsers.SAXParserFactory; 42 | import java.util.UUID; 43 | 44 | @RunWith(SpringJUnit4ClassRunner.class) 45 | @WebAppConfiguration 46 | @ContextConfiguration("/spring/test-context.xml") 47 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 48 | javax.persistence.NoResultException.class, 49 | org.springframework.dao.EmptyResultDataAccessException.class }) 50 | public class ATOMContentHandlerTests extends BaseTest { 51 | @Autowired 52 | @Qualifier("atomMarshaller") 53 | private Jaxb2Marshaller marshaller; 54 | 55 | @Autowired 56 | private EntryProcessorService entryProcessorService; 57 | 58 | @Test 59 | @Ignore 60 | public void processEnty() throws Exception { 61 | JAXBContext context = marshaller.getJaxbContext(); 62 | 63 | SAXParserFactory factory = SAXParserFactory.newInstance(); 64 | factory.setNamespaceAware(true); 65 | XMLReader reader = factory.newSAXParser().getXMLReader(); 66 | // EntryProcessorServiceImpl procssor = 67 | // mock(EntryProcessorServiceImpl.class); 68 | ATOMContentHandler atomContentHandler = new ATOMContentHandler(context, 69 | entryProcessorService); 70 | 71 | reader.setContentHandler(atomContentHandler); 72 | 73 | reader.parse(new InputSource(FixtureFactory 74 | .newUsagePointInputStream(UUID.randomUUID()))); 75 | 76 | // verify(procssor).process(any(EntryType.class)); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/integration/web/filters/CORSFilterTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.integration.web.filters; 22 | 23 | import org.greenbuttonalliance.espi.datacustodian.web.filter.CORSFilter; 24 | import org.junit.Before; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.context.annotation.Profile; 30 | import org.springframework.test.context.ContextConfiguration; 31 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 32 | import org.springframework.test.context.web.WebAppConfiguration; 33 | import org.springframework.test.web.servlet.MockMvc; 34 | import org.springframework.test.web.servlet.RequestBuilder; 35 | import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; 36 | import org.springframework.web.context.WebApplicationContext; 37 | 38 | import static org.hamcrest.Matchers.is; 39 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; 40 | import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup; 41 | 42 | @RunWith(SpringJUnit4ClassRunner.class) 43 | @WebAppConfiguration 44 | @ContextConfiguration("/spring/test-context.xml") 45 | @Profile("test") 46 | public class CORSFilterTests { 47 | 48 | @Autowired 49 | private CORSFilter filter; 50 | 51 | @Autowired 52 | private WebApplicationContext wac; 53 | 54 | private MockMvc mockMvc; 55 | 56 | @Before 57 | public void setup() { 58 | this.mockMvc = webAppContextSetup(this.wac).addFilters(filter).build(); 59 | } 60 | 61 | @Ignore 62 | @Test 63 | public void optionsResponse_hasCorrectFilters() throws Exception { 64 | RequestBuilder requestBuilder = MockMvcRequestBuilders.options( 65 | "/DataCustodian").header("Origin", "JUnit_Test"); 66 | 67 | mockMvc.perform(requestBuilder) 68 | .andExpect( 69 | header().string("Access-Control-Allow-Origin", is("*"))) 70 | .andExpect( 71 | header().string("Access-Control-Allow-Methods", 72 | is("GET, POST, PUT, DELETE, OPTIONS"))) 73 | .andExpect( 74 | header().string( 75 | "Access-Control-Allow-Headers", 76 | is("Origin, Authorization, Accept, Content-Type"))) 77 | .andExpect( 78 | header().string("Access-Control-Max-Age", is("1800"))) 79 | .andReturn(); 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/mocks/MockConsumerTokenServices.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.mocks; 22 | 23 | import org.springframework.security.oauth2.common.OAuth2AccessToken; 24 | import org.springframework.security.oauth2.provider.token.ConsumerTokenServices; 25 | import org.springframework.stereotype.Service; 26 | 27 | import java.util.Collection; 28 | 29 | @Service 30 | public class MockConsumerTokenServices implements ConsumerTokenServices { 31 | // @Override 32 | public Collection findTokensByUserName(String s) { 33 | return null; 34 | } 35 | 36 | // @Override 37 | public Collection findTokensByClientId(String s) { 38 | return null; 39 | } 40 | 41 | @Override 42 | public boolean revokeToken(String s) { 43 | return false; 44 | } 45 | 46 | // @Override 47 | public String getClientId(String s) { 48 | return null; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/models/atom/EntryTypeTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.models.atom; 22 | 23 | import org.greenbuttonalliance.espi.common.models.atom.EntryType; 24 | import org.junit.Test; 25 | 26 | import static org.hamcrest.CoreMatchers.equalTo; 27 | import static org.hamcrest.MatcherAssert.assertThat; 28 | 29 | public class EntryTypeTests { 30 | @Test 31 | public void addRelatedLink() throws Exception { 32 | EntryType entry = new EntryType(); 33 | 34 | entry.addRelatedLink("href"); 35 | 36 | assertThat(entry.getLinks().get(0).getHref(), equalTo("href")); 37 | assertThat(entry.getLinks().get(0).getRel(), equalTo("related")); 38 | } 39 | 40 | @Test 41 | public void addUpLink() throws Exception { 42 | EntryType entry = new EntryType(); 43 | 44 | entry.addUpLink("href"); 45 | 46 | assertThat(entry.getLinks().get(0).getHref(), equalTo("href")); 47 | assertThat(entry.getLinks().get(0).getRel(), equalTo("up")); 48 | } 49 | 50 | @Test 51 | public void getUpHref() throws Exception { 52 | EntryType entry = new EntryType(); 53 | 54 | entry.addUpLink("href"); 55 | 56 | assertThat(entry.getUpHref(), equalTo("href")); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/repositories/jpa/MeterReadingRepositoryImplTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.repositories.jpa; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.MeterReading; 24 | import org.greenbuttonalliance.espi.common.repositories.MeterReadingRepository; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.test.context.ContextConfiguration; 30 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 31 | import org.springframework.transaction.annotation.Transactional; 32 | 33 | import java.util.UUID; 34 | 35 | import static org.junit.Assert.assertNotNull; 36 | 37 | @RunWith(SpringJUnit4ClassRunner.class) 38 | @ContextConfiguration("/spring/test-context.xml") 39 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 40 | javax.persistence.NoResultException.class, 41 | org.springframework.dao.EmptyResultDataAccessException.class }) 42 | public class MeterReadingRepositoryImplTests { 43 | 44 | @Autowired 45 | protected MeterReadingRepository repository; 46 | 47 | @Ignore 48 | @Test 49 | public void findById_returnsMeterReading() { 50 | MeterReading meterReading = new MeterReading(); 51 | meterReading.setUUID(UUID.randomUUID()); 52 | 53 | repository.persist(meterReading); 54 | 55 | assertNotNull(repository.findById(meterReading.getId())); 56 | } 57 | 58 | @Ignore 59 | @Test 60 | public void findByUUID() { 61 | MeterReading meterReading = new MeterReading(); 62 | meterReading.setUUID(UUID.randomUUID()); 63 | 64 | repository.persist(meterReading); 65 | 66 | assertNotNull(repository.findByUUID(meterReading.getUUID())); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/DefaultControllerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.RetailCustomer; 24 | import org.junit.Test; 25 | import org.springframework.security.core.Authentication; 26 | 27 | import javax.servlet.http.HttpServletRequest; 28 | 29 | import static org.junit.Assert.assertEquals; 30 | import static org.mockito.Mockito.mock; 31 | import static org.mockito.Mockito.when; 32 | 33 | public class DefaultControllerTest { 34 | 35 | @Test 36 | public void whenRoleUser_redirectsToRetailCustomerHome() { 37 | DefaultController controller = new DefaultController(); 38 | RetailCustomer customer = new RetailCustomer(); 39 | customer.setId(99L); 40 | HttpServletRequest request = mock(HttpServletRequest.class); 41 | 42 | when(request.isUserInRole(RetailCustomer.ROLE_USER)).thenReturn(true); 43 | when(request.isUserInRole(RetailCustomer.ROLE_CUSTODIAN)).thenReturn( 44 | false); 45 | 46 | Authentication principal = mock(Authentication.class); 47 | when(principal.getPrincipal()).thenReturn(customer); 48 | 49 | assertEquals("redirect:/RetailCustomer/" + customer.getId() + "/home", 50 | controller.defaultAfterLogin(request, principal)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/HomeControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.junit.Ignore; 24 | import org.junit.Test; 25 | import org.junit.runner.RunWith; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.test.context.ContextConfiguration; 28 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 29 | import org.springframework.test.context.web.WebAppConfiguration; 30 | import org.springframework.transaction.annotation.Transactional; 31 | 32 | import static org.junit.Assert.assertEquals; 33 | 34 | @RunWith(SpringJUnit4ClassRunner.class) 35 | @WebAppConfiguration 36 | @ContextConfiguration("/spring/test-context.xml") 37 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 38 | javax.persistence.NoResultException.class, 39 | org.springframework.dao.EmptyResultDataAccessException.class }) 40 | public class HomeControllerTests { 41 | 42 | @Autowired 43 | protected HomeController controller; 44 | 45 | @Ignore 46 | @Test 47 | public void index_shouldDisplayHomePage() throws Exception { 48 | assertEquals("/home", controller.index()); 49 | } 50 | 51 | @Ignore 52 | @Test 53 | public void home_shouldDisplayHomePage() throws Exception { 54 | assertEquals("/home", controller.index()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/LoginControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web; 22 | 23 | import org.junit.Ignore; 24 | import org.junit.Test; 25 | import org.junit.runner.RunWith; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.test.context.ContextConfiguration; 28 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 29 | import org.springframework.test.context.web.WebAppConfiguration; 30 | import org.springframework.transaction.annotation.Transactional; 31 | 32 | import static org.junit.Assert.assertEquals; 33 | 34 | @RunWith(SpringJUnit4ClassRunner.class) 35 | @WebAppConfiguration 36 | @ContextConfiguration("/spring/test-context.xml") 37 | @Transactional(rollbackFor = { javax.xml.bind.JAXBException.class }, noRollbackFor = { 38 | javax.persistence.NoResultException.class, 39 | org.springframework.dao.EmptyResultDataAccessException.class }) 40 | public class LoginControllerTests { 41 | 42 | @Autowired 43 | protected LoginController controller; 44 | 45 | @Ignore 46 | @Test 47 | public void shouldDisplayLoginPage() throws Exception { 48 | assertEquals("login", controller.index()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/custodian/CustodianHomeControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.custodian; 22 | 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.assertEquals; 26 | 27 | public class CustodianHomeControllerTests { 28 | 29 | @Test 30 | public void index_displaysCustodianHomeView() throws Exception { 31 | CustodianHomeController controller = new CustodianHomeController(); 32 | assertEquals("/custodian/home", controller.index()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/custodian/UploadControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.custodian; 22 | 23 | import org.greenbuttonalliance.espi.common.service.ImportService; 24 | import org.junit.Before; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.mockito.Mockito; 28 | import org.springframework.validation.BindingResult; 29 | import org.springframework.validation.ObjectError; 30 | import org.springframework.web.multipart.MultipartFile; 31 | import org.xml.sax.SAXException; 32 | 33 | import java.io.InputStream; 34 | 35 | import static org.junit.Assert.assertEquals; 36 | import static org.mockito.Matchers.any; 37 | import static org.mockito.Mockito.mock; 38 | import static org.mockito.Mockito.verify; 39 | 40 | public class UploadControllerTests { 41 | 42 | private ImportService importService; 43 | private UploadController controller; 44 | private BindingResult result; 45 | private UploadForm form; 46 | 47 | @Before 48 | public void before() { 49 | controller = new UploadController(); 50 | 51 | importService = mock(ImportService.class); 52 | controller.setImportService(importService); 53 | 54 | form = new UploadForm(); 55 | form.setFile(mock(MultipartFile.class)); 56 | 57 | result = mock(BindingResult.class); 58 | } 59 | 60 | @Test 61 | public void upload_displaysUploadView() throws Exception { 62 | assertEquals("/custodian/upload", controller.upload()); 63 | } 64 | 65 | @Test 66 | @Ignore 67 | public void uploadPost_givenValidFile_importsUsagePointWithNoErrors() 68 | throws Exception { 69 | String view = controller.uploadPost(form, result); 70 | 71 | verify(importService).importData(any(InputStream.class), null); 72 | assertEquals(false, result.hasErrors()); 73 | assertEquals("redirect:/custodian/retailcustomers", view); 74 | } 75 | 76 | @Test 77 | @Ignore 78 | public void uploadPost_givenInvalidFile_displaysUploadViewWithErrors() 79 | throws Exception { 80 | Mockito.doThrow(new SAXException("Unable to process file")) 81 | .when(importService).importData(any(InputStream.class), null); 82 | 83 | String view = controller.uploadPost(form, result); 84 | 85 | assertEquals("/custodian/upload", view); 86 | verify(result).addError( 87 | new ObjectError("uploadForm", "Unable to process file")); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/customer/CustomerHomeControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 22 | 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.assertEquals; 26 | 27 | public class CustomerHomeControllerTests { 28 | 29 | @Test 30 | public void index_displaysCustomerHomeView() throws Exception { 31 | CustomerHomeController controller = new CustomerHomeController(); 32 | assertEquals("/customer/home", controller.index()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/customer/MeterReadingControllerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.MeterReading; 24 | import org.greenbuttonalliance.espi.common.service.MeterReadingService; 25 | import org.junit.Ignore; 26 | import org.junit.Test; 27 | import org.springframework.ui.ModelMap; 28 | 29 | import static org.junit.Assert.assertEquals; 30 | import static org.mockito.Matchers.anyLong; 31 | import static org.mockito.Mockito.mock; 32 | import static org.mockito.Mockito.when; 33 | 34 | public class MeterReadingControllerTest { 35 | 36 | @Ignore 37 | @Test 38 | public void show_displaysShowView() { 39 | MeterReadingController controller = new MeterReadingController(); 40 | controller.setMeterReadingService(mock(MeterReadingService.class)); 41 | 42 | assertEquals("/customer/meterreadings/show", 43 | controller.show(1L, 1L, 1L, new ModelMap())); 44 | } 45 | 46 | @Ignore 47 | @Test 48 | public void show_setsMeterReadingModel() { 49 | MeterReading meterReading = new MeterReading(); 50 | MeterReadingService meterReadingService = mock(MeterReadingService.class); 51 | MeterReadingController controller = new MeterReadingController(); 52 | controller.setMeterReadingService(meterReadingService); 53 | when(meterReadingService.findById(1L, 1L, anyLong())).thenReturn( 54 | meterReading); 55 | ModelMap model = new ModelMap(); 56 | 57 | controller.show(1L, 1L, 1L, model); 58 | 59 | assertEquals(meterReading, model.get("meterReading")); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/customer/ScopeSelectionControllerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.customer; 22 | 23 | import org.greenbuttonalliance.espi.common.domain.ApplicationInformation; 24 | import org.greenbuttonalliance.espi.common.service.ApplicationInformationService; 25 | import org.greenbuttonalliance.espi.common.test.EspiFactory; 26 | import org.junit.Test; 27 | 28 | import static org.junit.Assert.assertEquals; 29 | import static org.mockito.Mockito.mock; 30 | import static org.mockito.Mockito.when; 31 | 32 | public class ScopeSelectionControllerTests { 33 | 34 | @Test 35 | public void scopeSelection() throws Exception { 36 | ScopeSelectionController controller = new ScopeSelectionController(); 37 | 38 | ApplicationInformation applicationInformation = EspiFactory 39 | .newApplicationInformation(); 40 | applicationInformation 41 | .setThirdPartyScopeSelectionScreenURI("http://localhost:8080/ThirdParty/RetailCustomer/ScopeSelection"); 42 | 43 | ApplicationInformationService applicationInformationService = mock(ApplicationInformationService.class); 44 | controller 45 | .setApplicationInformationService(applicationInformationService); 46 | when( 47 | applicationInformationService 48 | .findByClientId(applicationInformation.getClientId())) 49 | .thenReturn(applicationInformation); 50 | 51 | String redirectURL = controller.scopeSelection(null, new String[] { 52 | "scope1", "scope2" }, applicationInformation.getClientId()); 53 | String[] scopes = applicationInformation.getScope().toArray( 54 | new String[applicationInformation.getScope().size()]); 55 | 56 | assertEquals(String.format( 57 | "redirect:%s?scope=%s&scope=%s&DataCustodianID=%s", 58 | applicationInformation.getThirdPartyScopeSelectionScreenURI(), 59 | scopes[0], scopes[1], 60 | applicationInformation.getDataCustodianId()), redirectURL); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/org/greenbuttonalliance/espi/datacustodian/web/filter/CORSFilterTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | * 5 | * Portions (c) 2013-2018 EnergyOS.org 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * 19 | */ 20 | 21 | package org.greenbuttonalliance.espi.datacustodian.web.filter; 22 | 23 | import org.junit.Test; 24 | import org.springframework.mock.web.MockHttpServletRequest; 25 | import org.springframework.mock.web.MockHttpServletResponse; 26 | 27 | import javax.servlet.FilterChain; 28 | 29 | import static org.mockito.Mockito.mock; 30 | import static org.mockito.Mockito.verify; 31 | 32 | public class CORSFilterTests { 33 | @Test 34 | public void testDoFilterInternal() throws Exception { 35 | CORSFilter corsFilter = new CORSFilter(); 36 | FilterChain filterChain = mock(FilterChain.class); 37 | MockHttpServletRequest request = new MockHttpServletRequest(); 38 | MockHttpServletResponse response = new MockHttpServletResponse(); 39 | 40 | corsFilter.doFilter(request, response, filterChain); 41 | 42 | verify(filterChain).doFilter(request, response); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/cucumber.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 25 | -------------------------------------------------------------------------------- /src/test/resources/features/API.feature: -------------------------------------------------------------------------------- 1 | Feature: API 2 | As an API client, 3 | I should be able to access the Data Custodian API, 4 | So that I can access electric usage data from Data Custodian 5 | 6 | Scenario: API client requests a list of Usage Points 7 | Given a Retail Customer with Usage Points 8 | When I GET /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint 9 | Then I should receive the list of Usage Points 10 | 11 | Scenario: API client reads a Usage Point 12 | Given a Retail Customer with Usage Points 13 | 14 | And I log in as Retail Customer 15 | When I GET /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint/{usagePointId} 16 | Then I should receive the Usage Point 17 | 18 | Scenario: API client uploads a new Usage Point 19 | Given a Retail Customer 20 | When I POST /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint 21 | And I log in as Alan Turing 22 | Then I should see a new Usage Point 23 | 24 | Scenario: API client updates an existing Usage Point 25 | Given a Retail Customer with Usage Points 26 | When I POST /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint 27 | And I PUT /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint/{usagePointId} 28 | And I log in as Alan Turing 29 | Then I should see an updated Usage Point 30 | 31 | Scenario: API client deletes an existing Usage Point 32 | Given a Retail Customer with Usage Points 33 | And I DELETE /espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint/{usagePointId} 34 | Then the Usage Point should be deleted 35 | -------------------------------------------------------------------------------- /src/test/resources/features/Authentication.feature: -------------------------------------------------------------------------------- 1 | Feature: Authentication 2 | Data Custodians should only have access to the home page and pages under /custodian folder. 3 | Retail Customers should only have access to the home page and pages under /customer folder. 4 | 5 | Scenario: Data Custodian visits Data Custodian's home page 6 | Given I have a Data Custodian account 7 | 8 | When I log in as a Data Custodian 9 | Then I should see Data Custodian home page 10 | 11 | Scenario: Retail Customer visits Retail Customer's home page 12 | Given I have a Retail Customer account 13 | 14 | When I log in as Alan Turing 15 | Then I should see Retail Customer home page 16 | -------------------------------------------------------------------------------- /src/test/resources/features/DataCustodian.feature: -------------------------------------------------------------------------------- 1 | Feature: Data Custodian 2 | As a Data Custodian 3 | I want to be able to create retail customers 4 | So that I can associate retail customers to their usage data 5 | 6 | Scenario: Data Custodian visits Data Custodian's home page 7 | Given I have a Data Custodian account 8 | 9 | When I log in as a Data Custodian 10 | Then I should see Data Custodian home page 11 | 12 | Scenario: Data Custodian logs in with valid credentials 13 | Given I have a Data Custodian account 14 | 15 | When I log in as a Data Custodian 16 | Then I should be logged in 17 | 18 | Scenario: User logs in with invalid credentials 19 | Given I have a Data Custodian account 20 | 21 | When I log in as a Data Custodian with invalid credentials 22 | Then I should see login form 23 | 24 | Scenario: Data Custodian creates customer 25 | Given I am a Data Custodian 26 | 27 | When I log in as a Data Custodian 28 | And I create a new Retail Customer 29 | Then I should see the new Retail Customer in the customer list 30 | 31 | Scenario: Data Custodian views customer list 32 | Given I am a Data Custodian 33 | And Alan Turing is a Retail Customer 34 | And I log in as a Data Custodian 35 | 36 | When I navigate to customer list page 37 | Then I should see Alan Turing in the customer list 38 | 39 | Scenario: Unauthenticated Data Custodian views customer list 40 | Given I am a Data Custodian 41 | And Alan Turing is a Retail Customer 42 | And I am not logged in 43 | 44 | When I navigate to customer list page 45 | Then I should see login form 46 | 47 | Scenario: Data Custodian views Retail Customer profile page 48 | When I log in as a Data Custodian 49 | And I navigate to customer list page 50 | And I select "Alan Turing" from customer list 51 | Then I should see "Alan Turing" profile page 52 | 53 | Scenario: Data Custodian associates a Usage Point with Retail Customer 54 | Given a Retail Customer 55 | 56 | When I log in as a Data Custodian 57 | And I associate "Back Electric Meter" Usage Point with Retail Customer 58 | 59 | When I log in as Retail Customer 60 | And I navigate to the Usage Points list 61 | Then I should see "Back Electric Meter" 62 | 63 | Scenario: Data Custodian uploads Retail Customer usage information 64 | Given a Retail Customer 65 | 66 | When I log in as a Data Custodian 67 | And I associate "Front Electric Meter" Usage Point with Retail Customer 68 | And I upload Usage Points 69 | 70 | When I log in as Retail Customer 71 | Then the logged in retail customer can see their usage data 72 | -------------------------------------------------------------------------------- /src/test/resources/features/ImportUsagePoint.feature: -------------------------------------------------------------------------------- 1 | Feature: Import Usage Point 2 | As a Data Custodian 3 | I want to be able to import XML UsagePoint data 4 | So that my Retail Customers can download their UsagePoint data 5 | 6 | Scenario: Data Custodian Imports Retail Customer Data 7 | Given a Retail Customer 8 | 9 | When I log in as a Data Custodian 10 | And I associate "Front Electric Meter" Usage Point with Retail Customer 11 | And I upload Usage Points 12 | 13 | When I log in as Retail Customer 14 | Then the logged in retail customer can see their usage data 15 | -------------------------------------------------------------------------------- /src/test/resources/features/Integration.feature: -------------------------------------------------------------------------------- 1 | Feature: Integration 2 | 3 | @spring 4 | Scenario: Data Custodian should be able to create a Retail Customer 5 | Given I have a Data Custodian account 6 | 7 | When I create a Retail Customer 8 | Then a Retail Customer should be created 9 | 10 | @spring 11 | Scenario: Import Usage Point 12 | When I import Usage Point 13 | Then Usage Point should be saved in the database 14 | And Meter Readings should be saved in the database 15 | And Reading Type should be saved in the database 16 | And Interval Blocks and Readings should be saved in the database 17 | And Electric Power Usage Summary should be saved in the database 18 | 19 | @spring 20 | Scenario: Import and export Usage Point 21 | When I import Usage Point 22 | And I export Usage Point 23 | Then export data should include Feed 24 | 25 | -------------------------------------------------------------------------------- /src/test/resources/features/RetailCustomers.feature: -------------------------------------------------------------------------------- 1 | Feature: Retail Customers 2 | As a Retail Customer, 3 | I want to be able to view my usage point in my browser 4 | So that I can see my UsagePoints 5 | 6 | Scenario: Logged in Retail Customer access unauthorized page 7 | Given I have a Retail Customer account 8 | And I log in as Alan Turing 9 | 10 | When I attempt to view custodian/home 11 | 12 | Then I should see an unauthorized screen 13 | 14 | Scenario: Retail Customer visits home page 15 | When I visit the home page 16 | Then I should see the option to login 17 | 18 | Scenario: Retail Customer visits Retail Customer's home page 19 | Given I have a Retail Customer account 20 | 21 | When I log in as Alan Turing 22 | Then I should see Retail Customer home page 23 | And I should see a Select Third Party link 24 | 25 | Scenario: Retail Customer visits Third Party list 26 | Given I have a Retail Customer account 27 | And There is a Third Party 28 | 29 | When I log in as Alan Turing 30 | And I click on the Select Third Party link 31 | 32 | Then I should see the Third Party list 33 | 34 | Scenario: Retail Customer views their usage data 35 | Given a Retail Customer with Usage Points 36 | 37 | When I log in as Retail Customer 38 | Then the logged in retail customer can see their usage data 39 | 40 | Scenario: Retail Customer downloads Usage Points in XML format 41 | Given a Retail Customer with Usage Points 42 | 43 | When I navigate to the Usage Points list 44 | Then I should be able to download Usage Points in XML format 45 | And the XML includes Service categories 46 | And the XML includes Meter Readings 47 | And the XML includes Reading Types 48 | And the XML includes Electric Power Usage Summary 49 | And the XML includes Interval Blocks 50 | And the XML includes Interval Readings 51 | And the XML includes Reading Qualities 52 | And the XML includes Electric Power Quality Summary 53 | And the XML includes Local Time Parameters 54 | -------------------------------------------------------------------------------- /src/test/resources/fixtures/ServiceCategory.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 9 24 | -------------------------------------------------------------------------------- /src/test/resources/fixtures/usage_point.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 25 | urn:uuid:15B0A4ED-CCF4-4521-A0A1-9FF650EC8A6B 26 | Green Button Subscription Feed 27 | 2012-10-24T00:00:00Z 28 | 29 | 30 | urn:uuid:48C2A019-5598-4E16-B0F9-49E4FF27F5FB 31 | 32 | 33 | 34 | 35 | 36 | 37 | Front Electric Meter 38 | 39 | 40 | 41 | 0 42 | 43 | 44 | 45 | 2012-10-24T00:00:00Z 46 | 2012-10-24T00:00:00Z 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2018-2020 Green Button Alliance, Inc. 3 | # 4 | # Portions copyright (c) 2013-2018 EnergyOS.org 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | # Set root logger level to DEBUG and its only appender to A1. 20 | #log4j.rootLogger=TRACE, file, A1 21 | #log4j.rootLogger=TRACE, A1 22 | #log4j.rootLogger=FATAL, A1 23 | #log4j.rootLogger=DEBUG, A1 24 | log4j.rootLogger=INFO, A1 25 | 26 | # A1 is set to be a ConsoleAppender. 27 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 28 | 29 | # A1 uses PatternLayout. 30 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 31 | log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n 32 | 33 | # Direct log messages to a log file 34 | log4j.appender.file=org.apache.log4j.RollingFileAppender 35 | log4j.appender.file.File=datacustodian.log 36 | log4j.appender.file.MaxFileSize=10MB 37 | log4j.appender.file.MaxBackupIndex=1 38 | log4j.appender.file.layout=org.apache.log4j.PatternLayout 39 | log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -------------------------------------------------------------------------------- /src/test/resources/spring/test-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/test/resources/spring/test-service-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /system.properties: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # Copyright (c) 2018-2021 Green Button Alliance, Inc. 4 | # 5 | # Portions (c) 2013-2018 EnergyOS.org 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # 20 | 21 | java.runtime.version=1.7 22 | --------------------------------------------------------------------------------