Skip to content

Commit 22baad5

Browse files
authored
Bump com.google.gerrit:gerrit-plugin-api from 2.14.16 to 2.15.21 (#64)
* Bump com.google.gerrit:gerrit-plugin-api from 2.14.16 to 2.15.21
1 parent b439067 commit 22baad5

File tree

7 files changed

+36
-23
lines changed

7 files changed

+36
-23
lines changed

eiffel-gerrit-plugin-script

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function do_stop {
3030
echo "########################################"
3131

3232
source target/env.bash
33-
docker-compose -f target/docker-compose.yml down
33+
docker compose -f target/docker-compose.yml down
3434
if [ $? -eq 1 ]; then
3535
echo "Failed to stop docker containers!"
3636
exit 1
@@ -62,12 +62,13 @@ function do_start {
6262
echo "########################################"
6363

6464
source target/env.bash
65-
docker-compose -f target/docker-compose.yml up -d
65+
docker compose -f target/docker-compose.yml up -d
6666

67-
wait_for_service "RABBITMQ" "target_rabbitmq" "15672"
68-
wait_for_service "GERRIT" "target_gerrit" "8080"
69-
wait_for_service "REMREM_PUBLISH" "target_publish" "8080"
70-
wait_for_service "REMREM_GENERATE" "target_generate" "8080"
67+
wait_for_service "RABBITMQ" "target-rabbitmq" "15672"
68+
wait_for_service "GERRIT" "target-gerrit" "8080"
69+
sleep 60
70+
wait_for_service "REMREM_PUBLISH" "target-publish" "8080"
71+
wait_for_service "REMREM_GENERATE" "target-generate" "8080"
7172
}
7273

7374
function do_test {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<properties>
1313
<Gerrit-ApiType>plugin</Gerrit-ApiType>
14-
<Gerrit-ApiVersion>2.14.16</Gerrit-ApiVersion>
14+
<Gerrit-ApiVersion>2.15.21</Gerrit-ApiVersion>
1515
<Gerrit-PluginName>Eiffel-Integration</Gerrit-PluginName>
1616
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1717
<skipTests>false</skipTests>

src/main/docker/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ LABEL maintainer="Eiffel-Community"
44

55
ARG JAR_LOCATION
66

7+
# Update repository URLs to point to the CentOS Vault
8+
RUN sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && \
9+
sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && \
10+
sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo
11+
712
RUN yum -y install openssh-client initscripts sudo
813

914
# Add Gerrit packages repository
@@ -12,7 +17,7 @@ RUN rpm -i https://gerritforge.com/gerritforge-repo-1-2.noarch.rpm
1217
# Install OpenJDK and Gerrit in two subsequent transactions
1318
# (pre-trans Gerrit script needs to have access to the Java command)
1419
RUN yum -y install java-1.8.0-openjdk
15-
RUN yum -y install gerrit-2.14.16-1
20+
RUN yum -y install gerrit-2.15.21-1
1621
RUN yum -y install bash
1722

1823
USER gerrit

src/main/docker/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '2'
1+
#version: '2'
22

33
services:
44
gerrit:

src/main/java/com/ericsson/gerrit/plugins/eiffel/git/CommitInformation.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.gerrit.extensions.restapi.IdString;
3030
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
3131
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
32+
import com.google.gerrit.server.permissions.PermissionBackendException;
3233
import com.google.gerrit.server.project.CommitResource;
3334
import com.google.gerrit.server.project.CommitsCollection;
3435
import com.google.gerrit.server.project.ProjectResource;
@@ -80,7 +81,7 @@ private List<RevCommit> getParents(final String commitId, final String projectNa
8081

8182
try {
8283
parents = getParentsFromCommit(commitId, projectName);
83-
} catch (final UnprocessableEntityException e) {
84+
} catch (final UnprocessableEntityException | PermissionBackendException e) {
8485
final String message = String.format("Cannot find or load the project %s", projectName);
8586
LOGGER.error(message, e);
8687
} catch (final ResourceNotFoundException e) {
@@ -95,15 +96,21 @@ private List<RevCommit> getParents(final String commitId, final String projectNa
9596
}
9697

9798
private List<RevCommit> getParentsFromCommit(final String commitId, final String projectName)
98-
throws UnprocessableEntityException, IOException, ResourceNotFoundException {
99-
99+
throws UnprocessableEntityException, IOException, ResourceNotFoundException, PermissionBackendException {
100+
RevCommit[] parents = null;
101+
try{
100102
final ProjectResource projectResource = projectsCollection.parse(projectName, true);
101103
final CommitResource commitResource = commitsCollection.parse(projectResource,
102104
IdString.fromDecoded(commitId));
103105
final RevCommit commit = commitResource.getCommit();
104-
final RevCommit[] parents = commit.getParents();
105-
106-
return Arrays.asList(parents);
106+
parents = commit.getParents();
107+
}
108+
catch (PermissionBackendException e) {
109+
System.out.println("PermissionBackendException is occured");
110+
}
111+
return Arrays.asList(parents);
112+
113+
107114
}
108115

109116
private List<String> getSHAs(final List<RevCommit> parents) {

src/main/java/com/ericsson/gerrit/plugins/eiffel/handlers/MessageQueueHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package com.ericsson.gerrit.plugins.eiffel.handlers;
1919

20-
import java.util.concurrent.ScheduledThreadPoolExecutor;
20+
import java.util.concurrent.ScheduledExecutorService;
2121

2222
import com.google.gerrit.extensions.annotations.PluginName;
2323
import com.google.gerrit.extensions.events.LifecycleListener;
@@ -32,7 +32,7 @@ public class MessageQueueHandler implements LifecycleListener {
3232

3333
private final WorkQueue workQueue;
3434
private final int poolSize;
35-
private ScheduledThreadPoolExecutor pool;
35+
private ScheduledExecutorService pool;
3636

3737
@Inject
3838
public MessageQueueHandler(final WorkQueue workQueue, final PluginConfigFactory config,
@@ -54,7 +54,7 @@ public void stop() {
5454
}
5555
}
5656

57-
public ScheduledThreadPoolExecutor getPool() {
57+
public ScheduledExecutorService getPool() {
5858
return this.pool;
5959
}
6060
}

src/test/java/com/ericsson/gerrit/plugins/eiffel/git/CommitInformationTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,24 @@ public void testFetchingParentsShas() throws Exception {
8787

8888
@Test
8989
public void testFetchingCommitNotFound() throws Exception {
90-
logHelper.removeStdoutAppenders();
91-
90+
logHelper.removeStdoutAppenders();
91+
9292
final CommitsCollection commitsCollection = mock(CommitsCollection.class);
9393
final ProjectsCollection projectsCollection = mock(ProjectsCollection.class);
9494
final ProjectResource projectResource = mock(ProjectResource.class);
95-
95+
9696
when(commitsCollection.parse(any(ProjectResource.class), any(IdString.class))).thenThrow(
9797
ResourceNotFoundException.class);
9898
when(projectsCollection.parse(any(String.class), anyBoolean())).thenReturn(projectResource);
99-
99+
100100
final CommitInformation commitInformation = new CommitInformation(commitsCollection,
101101
projectsCollection);
102102
final List<String> expectedParentsSha = Arrays.asList();
103103
final String commitId = "not found hash";
104104
final String projectName = "projectName";
105105

106106
final List<String> actualParentSha = commitInformation.getParentsSHAs(commitId, projectName);
107-
107+
108108
assertEquals(expectedParentsSha, actualParentSha);
109109
logHelper.verifyLoggerCalledTimes(1);
110110

0 commit comments

Comments
 (0)