├── docs ├── data_model.png ├── jsonapi_landing_page.png ├── graphiql_landing_page.png └── data_model.txt ├── db-builder ├── src │ ├── main │ │ ├── resources │ │ │ └── covid-19-data.tar.gz │ │ └── java │ │ │ └── com │ │ │ └── yahoo │ │ │ └── covid19 │ │ │ └── database │ │ │ ├── DBUtils.java │ │ │ ├── ErrorCodes.java │ │ │ ├── models │ │ │ ├── Insertable.java │ │ │ ├── HistoricalHealthRecords.java │ │ │ ├── Metadata.java │ │ │ ├── LatestHealthRecords.java │ │ │ └── Places.java │ │ │ ├── GsonUTCDateAdapter.java │ │ │ ├── GithubDataFetcher.java │ │ │ └── DataFetcher.java │ └── test │ │ ├── resources │ │ ├── META-INF │ │ │ └── resources │ │ │ │ └── covid-19-data.tar.gz │ │ └── logback.xml │ │ └── java │ │ └── com │ │ └── yahoo │ │ └── covid19 │ │ └── database │ │ ├── PlacesTest.java │ │ ├── models │ │ └── MetadataTest.java │ │ └── DatabaseBuilderTest.java └── pom.xml ├── .gitignore ├── webservice ├── src │ ├── main │ │ ├── resources │ │ │ ├── META-INF │ │ │ │ └── resources │ │ │ │ │ ├── api │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── images │ │ │ │ │ │ │ └── elide-white-logo.png │ │ │ │ │ │ ├── api_main.css │ │ │ │ │ │ └── api_main.js │ │ │ │ │ ├── graphiql │ │ │ │ │ │ ├── assets │ │ │ │ │ │ │ ├── graphql_main.css │ │ │ │ │ │ │ ├── graphql_main.js │ │ │ │ │ │ │ ├── fetch.min.js │ │ │ │ │ │ │ ├── es6-promise.auto.min.js │ │ │ │ │ │ │ └── react.min.js │ │ │ │ │ │ └── LICENSE │ │ │ │ │ └── swagger │ │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── swagger_main.css │ │ │ │ │ │ └── swagger_main.js │ │ │ │ │ │ └── LICENSE │ │ │ │ │ ├── akamai │ │ │ │ │ └── status.html │ │ │ ├── bootstrap.yaml │ │ │ ├── templates │ │ │ │ ├── swagger │ │ │ │ │ └── index.html │ │ │ │ ├── index.html │ │ │ │ └── graphiql │ │ │ │ │ └── index.html │ │ │ ├── logback-access-spring.xml │ │ │ ├── logback-spring.xml │ │ │ └── application.yaml │ │ └── java │ │ │ └── com │ │ │ └── yahoo │ │ │ └── covid19 │ │ │ ├── CacheProperties.java │ │ │ ├── models │ │ │ ├── package-info.java │ │ │ ├── Metadata.java │ │ │ ├── LatestHealthRecords.java │ │ │ ├── Place.java │ │ │ └── HealthRecords.java │ │ │ ├── controllers │ │ │ ├── TemplateEngine.java │ │ │ ├── SwaggerPageController.java │ │ │ ├── GraphiqlPageController.java │ │ │ ├── LandingPageController.java │ │ │ └── AsyncJsonApiController.java │ │ │ ├── WhiteListProperties.java │ │ │ ├── SecurityConfigProperties.java │ │ │ ├── CustomWebMvcConfigurer.java │ │ │ ├── filters │ │ │ ├── FilterConfiguration.java │ │ │ ├── RequestRejectedExceptionFilter.java │ │ │ ├── CacheControlFilter.java │ │ │ └── URIQueryValidator.java │ │ │ ├── ElideConfig.java │ │ │ ├── SpringWebSecurityConfig.java │ │ │ ├── EntityManagerSupplier.java │ │ │ ├── usertypes │ │ │ └── StringCollection.java │ │ │ └── App.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── yahoo │ │ │ └── covid19 │ │ │ ├── AppTestSetup.java │ │ │ ├── IntegrationTest.java │ │ │ ├── CorsTest.java │ │ │ └── filter │ │ │ └── URIQueryValidatorTest.java │ │ └── resources │ │ └── application.yaml └── pom.xml ├── screwdriver.yaml ├── contributors.md ├── CONTRIBUTING.md ├── settings.xml ├── db └── pom.xml ├── pom.xml ├── Code-Of-Conduct.md ├── README.md └── LICENSE /docs/data_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/docs/data_model.png -------------------------------------------------------------------------------- /docs/jsonapi_landing_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/docs/jsonapi_landing_page.png -------------------------------------------------------------------------------- /docs/graphiql_landing_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/docs/graphiql_landing_page.png -------------------------------------------------------------------------------- /db-builder/src/main/resources/covid-19-data.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/db-builder/src/main/resources/covid-19-data.tar.gz -------------------------------------------------------------------------------- /db-builder/src/test/resources/META-INF/resources/covid-19-data.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/db-builder/src/test/resources/META-INF/resources/covid-19-data.tar.gz -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | test-output/ 3 | .settings 4 | .classpath 5 | .checkstyle 6 | .idea/ 7 | .sonar/ 8 | *.iml 9 | bin 10 | dependency-reduced-pom.xml 11 | *.jar 12 | *.class 13 | *tags 14 | **.swp 15 | .project 16 | -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/assets/images/elide-white-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yahoo/covid-19-api/HEAD/webservice/src/main/resources/META-INF/resources/api/assets/images/elide-white-logo.png -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/graphiql/assets/graphql_main.css: -------------------------------------------------------------------------------- 1 | body { 2 | height: 100%; 3 | margin: 0; 4 | width: 100%; 5 | overflow: hidden; 6 | } 7 | #graphiql { 8 | height: 100vh; 9 | } -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/assets/api_main.css: -------------------------------------------------------------------------------- 1 | #iframe { 2 | left:0; 3 | bottom:0; 4 | right:0; 5 | width:100%; 6 | height:100vh; 7 | border:none; 8 | margin:0; 9 | padding:0; 10 | 11 | } -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/swagger/assets/swagger_main.css: -------------------------------------------------------------------------------- 1 | html 2 | { 3 | box-sizing: border-box; 4 | overflow: -moz-scrollbars-vertical; 5 | overflow-y: scroll; 6 | } 7 | 8 | *, 9 | *:before, 10 | *:after 11 | { 12 | box-sizing: inherit; 13 | } 14 | 15 | body 16 | { 17 | margin:0; 18 | background: #fafafa; 19 | } -------------------------------------------------------------------------------- /db-builder/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %date %level [%thread] %logger{10} [%file:%line] %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /webservice/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | ################################################ 2 | # Copyright 2020, Verizon Media. 3 | # Licensed under the Apache License, Version 2.0 4 | # See LICENSE file in project root for terms. 5 | ################################################ 6 | 7 | spring: 8 | application: 9 | name: Elide-Covid19 10 | 11 | logging: 12 | path: /tmp/log/covid-19-api 13 | -------------------------------------------------------------------------------- /db-builder/src/main/java/com/yahoo/covid19/database/DBUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19.database; 8 | 9 | public class DBUtils { 10 | public static final String DB_NAME = "covid19"; 11 | public static final String DB_DIR_NAME = DB_NAME; 12 | public static final String DB_FILE_NAME = DB_NAME + ".mv.db"; 13 | } 14 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/CacheProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | package com.yahoo.covid19; 7 | 8 | import lombok.Data; 9 | 10 | @Data 11 | public class CacheProperties { 12 | private boolean enabled = false; 13 | /** 14 | * Interval at which cache should be cleared. 15 | */ 16 | private long duration = 60; 17 | } 18 | -------------------------------------------------------------------------------- /db-builder/src/main/java/com/yahoo/covid19/database/ErrorCodes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19.database; 8 | 9 | public enum ErrorCodes { 10 | OK, 11 | INVALID_ID, 12 | INVALID_TYPE, 13 | INVALID_COORDINATE, 14 | INVALID_DATE, 15 | MISSING_FOREIGN_KEY, 16 | DANGLING_FOREIGN_KEY, 17 | MISMATCH_FOREIGN_KEY 18 | } 19 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/models/package-info.java: -------------------------------------------------------------------------------- 1 | @ReadPermission(expression = "Prefab.Role.All") 2 | @CreatePermission(expression = "Prefab.Role.None") 3 | @DeletePermission(expression = "Prefab.Role.None") 4 | @UpdatePermission(expression = "Prefab.Role.None") 5 | package com.yahoo.covid19.models; 6 | 7 | import com.yahoo.elide.annotation.CreatePermission; 8 | import com.yahoo.elide.annotation.DeletePermission; 9 | import com.yahoo.elide.annotation.ReadPermission; 10 | import com.yahoo.elide.annotation.UpdatePermission; 11 | -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/swagger/assets/swagger_main.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | // Begin Swagger UI call region 3 | const ui = SwaggerUIBundle({ 4 | url: "/api/doc/v1", 5 | dom_id: '#swagger-ui', 6 | deepLinking: true, 7 | presets: [ 8 | SwaggerUIBundle.presets.apis, 9 | SwaggerUIStandalonePreset 10 | ], 11 | plugins: [ 12 | SwaggerUIBundle.plugins.DownloadUrl 13 | ], 14 | layout: "StandaloneLayout" 15 | }) 16 | // End Swagger UI call region 17 | 18 | window.ui = ui 19 | } -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/controllers/TemplateEngine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19.controllers; 8 | 9 | import com.google.common.io.Resources; 10 | 11 | import java.io.IOException; 12 | import java.net.URL; 13 | import java.nio.charset.StandardCharsets; 14 | 15 | public class TemplateEngine { 16 | public static String getTemplate(String path) throws IOException { 17 | URL url = Resources.getResource(path); 18 | return Resources.toString(url, StandardCharsets.UTF_8); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/swagger/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 SmartBear Software 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) 6 | 7 | Unless required by applicable law or agreed to in writing, software 8 | distributed under the License is distributed on an "AS IS" BASIS, 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | See the License for the specific language governing permissions and 11 | limitations under the License. 12 | -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/assets/api_main.js: -------------------------------------------------------------------------------- 1 | function switchFrame(url, element) { 2 | let activeElements = document.getElementsByClassName('is-active'); 3 | 4 | for (let item of activeElements) { 5 | item.classList.remove('is-active'); 6 | } 7 | 8 | document.getElementById('iframe').src = url; 9 | element.classList.add('is-active'); 10 | } 11 | 12 | window.onload = function() { 13 | document.getElementById('json-api_switch').onclick = function() { 14 | switchFrame('/api/swagger/index.html', this) 15 | }; 16 | document.getElementById('graphiql_switch').onclick = function() { 17 | switchFrame('/api/graphiql/index.html', this) 18 | }; 19 | } -------------------------------------------------------------------------------- /webservice/src/test/java/com/yahoo/covid19/AppTestSetup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19; 8 | 9 | import com.google.common.io.Files; 10 | import org.springframework.boot.test.context.TestConfiguration; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Primary; 13 | 14 | import java.io.File; 15 | 16 | @TestConfiguration 17 | public class AppTestSetup { 18 | 19 | @Bean 20 | @Primary 21 | public File getTestDatabaseDirectory() { 22 | return Files.createTempDir(); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/models/Metadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | package com.yahoo.covid19.models; 7 | 8 | import com.yahoo.elide.annotation.Include; 9 | 10 | import javax.persistence.Entity; 11 | import javax.persistence.Id; 12 | import javax.persistence.Table; 13 | import java.util.Date; 14 | 15 | @Include(rootLevel = true, type = "metadata") 16 | @Entity 17 | @Table(name = "metadata") 18 | public class Metadata { 19 | @Id 20 | private String id; 21 | 22 | public Date healthRecordsEndDate; 23 | public Date healthRecordsStartDate; 24 | public Date publishedDate; 25 | } 26 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/WhiteListProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | package com.yahoo.covid19; 7 | 8 | import lombok.Data; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | @Data 14 | public class WhiteListProperties { 15 | private RuleState ruleState = RuleState.WARN; 16 | private List uri = Arrays.asList(); //block all the query by default. 17 | 18 | public enum RuleState{ 19 | ON, 20 | OFF, 21 | WARN 22 | } 23 | 24 | public boolean isRuleState(RuleState rule) { 25 | return ruleState.equals(rule); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/SecurityConfigProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19; 8 | 9 | import org.springframework.boot.context.properties.ConfigurationProperties; 10 | 11 | import lombok.Data; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | @Data 17 | @ConfigurationProperties(prefix = "security") 18 | public class SecurityConfigProperties { 19 | private String origin = "*"; 20 | private boolean indexPageEnabled = true; 21 | private boolean cspEnabled = false; 22 | private CacheProperties cache; 23 | private WhiteListProperties whiteList; 24 | } 25 | -------------------------------------------------------------------------------- /screwdriver.yaml: -------------------------------------------------------------------------------- 1 | jobs: 2 | build: 3 | annotations: 4 | screwdriver.cd/disk: HIGH 5 | screwdriver.cd/ram: HIGH 6 | screwdriver.cd/buildPeriodically: H * * * * 7 | secrets: 8 | - BINTRAY_USER 9 | - BINTRAY_API_KEY 10 | # Remove SCM_* secrets once project is public 11 | - SCM_USERNAME 12 | - SCM_ACCESS_TOKEN 13 | environment: 14 | VERSION: $SD_EVENT_ID 15 | image: maven:3.6.3-jdk-8-openj9 16 | requires: [~pr, ~commit] 17 | steps: 18 | - test_and_publish: | 19 | if [ ! -z $SD_PULL_REQUEST ]; then 20 | echo Skipping publish in PR build 21 | mvn clean test 22 | else 23 | mvn versions:set -DnewVersion=1.5.${VERSION} -DprocessAllModules=true 24 | mvn -B clean deploy --settings ./settings.xml 25 | fi 26 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/CustomWebMvcConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | package com.yahoo.covid19; 7 | 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; 10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 11 | 12 | @Configuration 13 | public class CustomWebMvcConfigurer implements WebMvcConfigurer { 14 | 15 | @Override 16 | public void addViewControllers(ViewControllerRegistry registry) { 17 | registry.addViewController("/").setViewName("redirect:/api/"); 18 | registry.addViewController("/api").setViewName("redirect:/api/"); 19 | registry.addViewController("/api/").setViewName("forward:/api/index.html"); 20 | } 21 | } -------------------------------------------------------------------------------- /docs/data_model.txt: -------------------------------------------------------------------------------- 1 | @startuml 2 | 3 | 4 | class HealthRecords { 5 | id 6 | referenceDate 7 | totalDeaths 8 | totalConfirmedCases 9 | totalRecoveredCases 10 | totalTestedCases 11 | numActiveCases 12 | numPendingTests 13 | numRecoveredCases 14 | numTested 15 | } 16 | 17 | class LatestHealthRecords { 18 | id 19 | referenceDate 20 | totalDeaths 21 | totalConfirmedCases 22 | totalRecoveredCases 23 | totalTestedCases 24 | numActiveCases 25 | numPendingTests 26 | numRecoveredCases 27 | numTested 28 | } 29 | 30 | class Place { 31 | id 32 | label 33 | latitude 34 | longitude 35 | placeType 36 | population 37 | wikiId 38 | -- 39 | -Set parents 40 | -Set children 41 | } 42 | 43 | Place "*" *-down- "*" Place: parents 44 | Place "*" *-up- "*" Place: children 45 | HealthRecords "*" *-up- "1" Place 46 | LatestHealthRecords "*" *-up- "1" Place 47 | 48 | @enduml -------------------------------------------------------------------------------- /contributors.md: -------------------------------------------------------------------------------- 1 | Thanks goes to these wonderful people: 2 | 3 | Aaron Klish\ 4 | Alvaro Mendez\ 5 | Amit Kumar\ 6 | Anders Beitnes\ 7 | Asaf Ary\ 8 | Ashley Wolf\ 9 | Balaji Manoharan\ 10 | Cedar Pan\ 11 | Chad Boyd\ 12 | Chandrasekar Rajasekar\ 13 | Chas Turansky\ 14 | Chris Williamson\ 15 | Cindy Wang\ 16 | Daniel Tan\ 17 | Gil Yehuda\ 18 | Hardik Patel\ 19 | Iván Markman\ 20 | Jay Torres\ 21 | Jithin Emmanuel\ 22 | Jon Kilroy\ 23 | Jordan Schwartz\ 24 | Kannan Ramamoorthy\ 25 | Karthik Vasudevan\ 26 | Kaushik Satpathy\ 27 | Kevin Hinterlong\ 28 | Kiran Kumar Joseph\ 29 | Luke Sheppard\ 30 | Michael F. Martin\ 31 | Mike Welch\ 32 | Mohanakrishnakumar Karunakaran\ 33 | Mohit Arora\ 34 | Nicolas Torzec\ 35 | Nil Sahoo\ 36 | Paul Donnelly\ 37 | Riaz Munshi\ 38 | Rohan Nogueira\ 39 | Rosalie Bartlett\ 40 | Runqi Shao\ 41 | Ryan Mihalko\ 42 | Sam Groth\ 43 | Sanil Ghatpande\ 44 | Sean Poris\ 45 | Sri Pulla\ 46 | Stephanie Blair\ 47 | Suresh Visvanathan\ 48 | Suriya Sundar Sampath\ 49 | Tiffany Kyi\ 50 | Vipin V 51 | -------------------------------------------------------------------------------- /webservice/src/main/resources/templates/swagger/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Swagger UI 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /webservice/src/main/resources/logback-access-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ${logDir}/access.log 7 | 8 | ${logDir}/archived/access_%d{yyyy-MM-dd}.log 9 | 30 10 | 100MB 11 | 12 | 13 | %date{yyyy-MM-dd HH:mm:ss.SSS Z} REMOTE_IP=%remoteIP USER=%user METHOD=%requestMethod URI=%requestURI STATUS=%statusCode BYTES_SENT=%bytesSent ELAPSED_TIME=%elapsedTime HEADER_X-B3-TraceId=%header{X-B3-TraceId} REQUEST_CONTEXT=%requestContent 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /webservice/src/test/java/com/yahoo/covid19/IntegrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | package com.yahoo.covid19; 7 | 8 | import com.jayway.restassured.RestAssured; 9 | import org.junit.jupiter.api.BeforeAll; 10 | import org.junit.jupiter.api.TestInstance; 11 | import org.springframework.boot.test.context.SpringBootTest; 12 | import org.springframework.boot.web.server.LocalServerPort; 13 | import org.springframework.context.annotation.Import; 14 | 15 | /** 16 | * Base class for running a set of functional Elide tests. This class 17 | * sets up an Elide instance with an in-memory H2 database. 18 | */ 19 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) 20 | @TestInstance(TestInstance.Lifecycle.PER_CLASS) 21 | @Import(AppTestSetup.class) 22 | public class IntegrationTest { 23 | 24 | @LocalServerPort 25 | int port; 26 | 27 | @BeforeAll 28 | public void setUp() throws Exception { 29 | RestAssured.port = port; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /webservice/src/main/java/com/yahoo/covid19/filters/FilterConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020, Verizon Media. 3 | * Licensed under the Apache License, Version 2.0 4 | * See LICENSE file in project root for terms. 5 | */ 6 | 7 | package com.yahoo.covid19.filters; 8 | 9 | import ch.qos.logback.access.servlet.TeeFilter; 10 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | /** 15 | * Configuration for request/response logging. 16 | */ 17 | @Configuration 18 | public class FilterConfiguration { 19 | 20 | @Bean 21 | public FilterRegistrationBean requestResponseFilter() { 22 | final FilterRegistrationBean filterRegBean = new FilterRegistrationBean<>(); 23 | TeeFilter filter = new TeeFilter(); 24 | filterRegBean.setFilter(filter); 25 | filterRegBean.addUrlPatterns("/*"); 26 | filterRegBean.setName("Request Response Logging Filter"); 27 | filterRegBean.setAsyncSupported(Boolean.TRUE); 28 | return filterRegBean; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /webservice/src/main/resources/META-INF/resources/api/graphiql/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 GraphQL Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to Contribute 2 | 3 | When submitting a pull request (PR), please use the following guidelines: 4 | 5 | - Make sure your code respects existing formatting conventions. In general, follow 6 | the same coding style as the code that you are modifying. If you are using 7 | IntelliJ, you can import our code style settings xml: 8 | [elide-intellij-codestyle.xml](https://github.com/yahoo/elide/raw/master/elide-intellij-codestyle.xml). 9 | - Bugfixes should include a unit test or integration test reproducing the issue. 10 | - Do not use author tags/information in the code. 11 | - Always include license header on each file your create. See [this example](https://github.com/yahoo/elide/blob/master/elide-core/src/main/java/com/yahoo/elide/Elide.java) 12 | - Try to keep pull requests short and submit separate ones for unrelated 13 | features, but feel free to combine simple bugfixes/tests into one pull request. 14 | - Keep the number of commits small and combine commits for related changes. 15 | Each commit should compile on its own and ideally pass tests. 16 | - Keep formatting changes in separate commits to make code reviews easier and 17 | distinguish them from actual code changes. 18 | - Please be respectful and follow the [code of conduct](Code-Of-Conduct.md) 19 | -------------------------------------------------------------------------------- /webservice/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Covid-19 API 14 | 15 | 16 | 17 | 18 | 19 | 30 |