Adapt to Project.NameKey refactoring
Change-Id: Ib958063fd3d2311630074084fe8f5cf0d0595030
diff --git a/src/main/java/com/googlesource/gerrit/plugins/webhooks/rest/ProjectsCollection.java b/src/main/java/com/googlesource/gerrit/plugins/webhooks/rest/ProjectsCollection.java
index ef5df60..0817969 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/webhooks/rest/ProjectsCollection.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/webhooks/rest/ProjectsCollection.java
@@ -52,9 +52,9 @@
}
private ProjectWebhooksResource parse(String id) throws ResourceNotFoundException {
- Project.NameKey n = new Project.NameKey(id);
+ Project.NameKey n = Project.nameKey(id);
if (projectCache.get(n) != null) {
- return new ProjectWebhooksResource(new Project.NameKey(id));
+ return new ProjectWebhooksResource(Project.nameKey(id));
}
throw new ResourceNotFoundException(String.format("Project %s does not exist", id));
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/webhooks/EventHandlerTest.java b/src/test/java/com/googlesource/gerrit/plugins/webhooks/EventHandlerTest.java
index eb677e1..404402a 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/webhooks/EventHandlerTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/webhooks/EventHandlerTest.java
@@ -35,7 +35,7 @@
@RunWith(MockitoJUnitRunner.class)
public class EventHandlerTest {
- private static final Project.NameKey PROJECT_NAME = new Project.NameKey("p");
+ private static final Project.NameKey PROJECT_NAME = Project.nameKey("p");
private static final String PLUGIN = "webhooks";
private static final String REMOTE = "remote";
private static final String FOO = "foo";
diff --git a/src/test/java/com/googlesource/gerrit/plugins/webhooks/PostTaskTest.java b/src/test/java/com/googlesource/gerrit/plugins/webhooks/PostTaskTest.java
index e5de105..40bf6eb 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/webhooks/PostTaskTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/webhooks/PostTaskTest.java
@@ -69,7 +69,7 @@
when(remote.getUrl()).thenReturn(WEBHOOK_URL);
when(processor.process(eq(projectCreated), eq(remote))).thenReturn(Optional.of(content));
when(sessionFactory.create(eq(remote))).thenReturn(session);
- when(projectCreated.getProjectNameKey()).thenReturn(new Project.NameKey("test"));
+ when(projectCreated.getProjectNameKey()).thenReturn(Project.nameKey("test"));
task = new PostTask(executor, sessionFactory, processor, projectCreated, remote);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/webhooks/processors/AbstractEventProcessorTest.java b/src/test/java/com/googlesource/gerrit/plugins/webhooks/processors/AbstractEventProcessorTest.java
index bb2e4b6..807f7b0 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/webhooks/processors/AbstractEventProcessorTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/webhooks/processors/AbstractEventProcessorTest.java
@@ -33,7 +33,7 @@
@RunWith(MockitoJUnitRunner.class)
public class AbstractEventProcessorTest {
private static final String PROJECT = "p";
- private static final Project.NameKey PROJECT_NAME = new Project.NameKey(PROJECT);
+ private static final Project.NameKey PROJECT_NAME = Project.nameKey(PROJECT);
private static final ProjectCreatedEvent PROJECT_CREATED =
new ProjectCreatedEvent() {