Skip to content

Commit

Permalink
Merge pull request #310 from amihaiemil/308
Browse files Browse the repository at this point in the history
#308 removed Projects.getByWebHookToken
  • Loading branch information
amihaiemil authored Aug 28, 2021
2 parents 04e58e5 + 73d5200 commit 2d0474b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 56 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<name>Self XDSD Storage Module</name>
<description>Storage Module for Self XDSD</description>
<properties>
<self.core.version>0.0.90</self.core.version>
<self.core.version>0.0.92</self.core.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
Expand Down
20 changes: 0 additions & 20 deletions src/main/java/com/selfxdsd/storage/SelfProjects.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,6 @@ public Project getProjectById(
return project;
}

@Override
public Project getByWebHookToken(final String webHookToken) {
return this.database.jooq()
.select()
.from(SLF_PROJECTS_XDSD)
.join(SLF_USERS_XDSD)
.on(
SLF_PROJECTS_XDSD.USERNAME.eq(SLF_USERS_XDSD.USERNAME).and(
SLF_PROJECTS_XDSD.PROVIDER.eq(SLF_USERS_XDSD.PROVIDER)
)
)
.join(SLF_PMS_XDSD)
.on(SLF_PROJECTS_XDSD.PMID.eq(SLF_PMS_XDSD.ID))
.where(SLF_PROJECTS_XDSD.WEBHOOK_TOKEN.eq(webHookToken))
.stream()
.map(rec -> projectFromRecord(rec, false))
.findFirst()
.orElse(null);
}

@Override
public Projects page(final Page page) {
return new SelfProjects(
Expand Down
35 changes: 0 additions & 35 deletions src/test/java/com/selfxdsd/storage/SelfProjectsITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,41 +84,6 @@ public void returnsNullIfProjectMissing() {
);
}

/**
* Returns a project by its WebHook Token.
*/
@Test
public void getsProjectByWebHookToken() {
final Projects projects = new SelfJooq(new H2Database()).projects();
final Project found = projects.getByWebHookToken("whtoken123");
MatcherAssert.assertThat(
found.repoFullName(),
Matchers.equalTo("amihaiemil/docker-java-api")
);
MatcherAssert.assertThat(
found.owner().username(),
Matchers.equalTo("amihaiemil")
);
MatcherAssert.assertThat(
found.projectManager().id(),
Matchers.equalTo(1)
);
MatcherAssert.assertThat(
found.projectManager().provider().name(),
Matchers.equalTo(Provider.Names.GITHUB)
);
}

/**
* Returns null the project is not found by webhook token.
*/
@Test
public void returnsNullIfProjectNotFountByWebHookToken() {
final Projects projects = new SelfJooq(new H2Database()).projects();
final Project found = projects.getByWebHookToken("missing-token-123");
MatcherAssert.assertThat(found, Matchers.nullValue());
}

/**
* SelfProjects can return the Projects owned by a certain User.
*/
Expand Down

0 comments on commit 2d0474b

Please sign in to comment.