-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EVA-2217 Improve release api #143
Open
andresfsilva
wants to merge
5
commits into
EBIvariation:master
Choose a base branch
from
andresfsilva:feature/improve-release-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+682
−38
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
94f2279
add tests
andresfsilva d618bc9
swagger support
andresfsilva 40e0951
change long jpa methods for sql native queries
andresfsilva dff105b
update gitlab ci/cd to include eva-release module
andresfsilva bf2a4a1
use complete name in eva-release artifacts
andresfsilva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
eva-release/src/test/java/uk/ac/ebi/eva/release/controllers/ReleaseInfoControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright 2020 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.release.controllers; | ||
|
||
import org.assertj.core.util.IterableUtil; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import uk.ac.ebi.eva.release.Application; | ||
import uk.ac.ebi.eva.release.models.ReleaseInfo; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@SpringBootTest(classes = Application.class) | ||
@RunWith(SpringRunner.class) | ||
public class ReleaseInfoControllerTest { | ||
|
||
@Autowired | ||
private ReleaseInfoController releaseInfoController; | ||
|
||
@Test | ||
public void getOneReleaseInfo() { | ||
int releaseVersion = 1; | ||
Iterable<ReleaseInfo> releaseInfo = releaseInfoController.getReleaseInfo(releaseVersion); | ||
assertEquals(releaseVersion, releaseInfo.iterator().next().getReleaseVersion()); | ||
} | ||
|
||
@Test | ||
public void getAllReleasesInfo() { | ||
Integer releaseVersion = null; | ||
Iterable<ReleaseInfo> releaseInfo = releaseInfoController.getReleaseInfo(releaseVersion); | ||
assertEquals(2, IterableUtil.sizeOf(releaseInfo)); | ||
} | ||
|
||
@Test | ||
public void getLatestReleaseInfo() { | ||
int latestReleaseVersion = 2; | ||
ReleaseInfo latestReleaseInfo = releaseInfoController.getLatestReleaseInfo(); | ||
assertEquals(latestReleaseVersion, latestReleaseInfo.getReleaseVersion()); | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
eva-release/src/test/java/uk/ac/ebi/eva/release/controllers/ReleaseStatsControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright 2020 EMBL - European Bioinformatics Institute | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package uk.ac.ebi.eva.release.controllers; | ||
|
||
import org.assertj.core.util.IterableUtil; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import uk.ac.ebi.eva.release.Application; | ||
import uk.ac.ebi.eva.release.dto.ReleaseStatsPerSpeciesDto; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
@SpringBootTest(classes = Application.class) | ||
@RunWith(SpringRunner.class) | ||
public class ReleaseStatsControllerTest { | ||
|
||
@Autowired | ||
private ReleaseStatsController releaseStatsController; | ||
|
||
@Test | ||
public void getAllSpeciesStats() { | ||
int totalNumberOfRecords = 417; | ||
Iterable<ReleaseStatsPerSpeciesDto> allRecords = releaseStatsController.getReleaseStatsPerSpecies(null, false); | ||
assertEquals(totalNumberOfRecords, IterableUtil.sizeOf(allRecords)); | ||
} | ||
|
||
@Test | ||
public void getStatsByReleaseVersion() { | ||
int speciesInRelease2 = 218; | ||
Iterable<ReleaseStatsPerSpeciesDto> allRecords = releaseStatsController.getReleaseStatsPerSpecies(2, false); | ||
assertEquals(speciesInRelease2, IterableUtil.sizeOf(allRecords)); | ||
} | ||
|
||
@Test | ||
public void getStatsByReleaseVersionNoUnmapped() { | ||
int speciesInRelease1ExcludingUnmapped = 58; | ||
Iterable<ReleaseStatsPerSpeciesDto> release1 = releaseStatsController.getReleaseStatsPerSpecies(1, true); | ||
assertEquals(speciesInRelease1ExcludingUnmapped, IterableUtil.sizeOf(release1)); | ||
|
||
int speciesInRelease2ExcludingUnmapped = 79; | ||
Iterable<ReleaseStatsPerSpeciesDto> release2 = releaseStatsController.getReleaseStatsPerSpecies(2, true); | ||
assertEquals(speciesInRelease2ExcludingUnmapped, IterableUtil.sizeOf(release2)); | ||
} | ||
|
||
@Test | ||
public void getStatsForNewVariantsOnlyInSpecificRelease() { | ||
int numberOfSpeciesWithNewVariantsRelease1 = 199; | ||
Iterable<ReleaseStatsPerSpeciesDto> Release1 = releaseStatsController.getSpeciesWithNewRsIds(1); | ||
assertEquals(numberOfSpeciesWithNewVariantsRelease1, IterableUtil.sizeOf(Release1)); | ||
|
||
int numberOfSpeciesWithNewVariantsRelease2 = 29; | ||
Iterable<ReleaseStatsPerSpeciesDto> Release2 = releaseStatsController.getSpeciesWithNewRsIds(2); | ||
assertEquals(numberOfSpeciesWithNewVariantsRelease2, IterableUtil.sizeOf(Release2)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
spring.datasource.driver-class-name=org.hsqldb.jdbcDriver | ||
spring.datasource.url=jdbc:hsqldb:mem:db;sql.syntax_pgs=true;DB_CLOSE_DELAY=-1 | ||
spring.datasource.username=SA | ||
spring.datasource.password= | ||
|
||
spring.jpa.generate-ddl=true | ||
spring.jpa.show-sql=true | ||
|
||
# See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#bean-overriding | ||
spring.main.allow-bean-definition-overriding=true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we refactor the query string for getAllExcludingUnmappedOnly into a variable and just add a release_version condition for this method?