// Path: src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java
// public static class GitUpdateProcessing implements PushResultProcessing {
//   private static final FluentLogger logger = FluentLogger.forEnclosingClass();
// 
//   private final EventDispatcher dispatcher;
// 
//   public GitUpdateProcessing(EventDispatcher dispatcher) {
//     this.dispatcher = dispatcher;
//   }
// 
//   @Override
//   public void onRefReplicatedToOneNode(
//       String project,
//       String ref,
//       URIish uri,
//       RefPushResult status,
//       RemoteRefUpdate.Status refStatus) {
//     postEvent(new RefReplicatedEvent(project, ref, uri, status, refStatus));
//   }
// 
//   @Override
//   public void onRefReplicatedToAllNodes(String project, String ref, int nodesCount) {
//     postEvent(new RefReplicationDoneEvent(project, ref, nodesCount));
//   }
// 
//   private void postEvent(RefEvent event) {
//     try {
//       dispatcher.postEvent(event);
//     } catch (StorageException | PermissionBackendException e) {
//       logger.atSevere().withCause(e).log("Cannot post event");
//     }
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java
// public enum RefPushResult {
//   /** The ref was not successfully replicated. */
//   FAILED,
// 
//   /** The ref is not configured to be replicated. */
//   NOT_ATTEMPTED,
// 
//   /** The ref was successfully replicated. */
//   SUCCEEDED;
// 
//   @Override
//   public String toString() {
//     return name().toLowerCase().replace("_", "-");
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/events/RefReplicatedEvent.java
// public class RefReplicatedEvent extends RemoteRefReplicationEvent {
//   public static final String TYPE = "ref-replicated";
// 
//   @Deprecated public final String targetNode;
//   public final Status refStatus;
// 
//   public RefReplicatedEvent(
//       String project,
//       String ref,
//       URIish targetUri,
//       RefPushResult status,
//       RemoteRefUpdate.Status refStatus) {
//     super(TYPE, project, ref, targetUri, status.toString());
//     this.targetNode = resolveNodeName(targetUri);
//     this.refStatus = refStatus;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof RefReplicatedEvent)) {
//       return false;
//     }
//     RefReplicatedEvent event = (RefReplicatedEvent) other;
//     if (!Objects.equals(event.project, this.project)) {
//       return false;
//     }
//     if (!Objects.equals(event.ref, this.ref)) {
//       return false;
//     }
//     if (!Objects.equals(event.targetNode, this.targetNode)) {
//       return false;
//     }
//     if (!Objects.equals(event.targetUri, this.targetUri)) {
//       return false;
//     }
//     if (!Objects.equals(event.status, this.status)) {
//       return false;
//     }
//     if (!Objects.equals(event.refStatus, this.refStatus)) {
//       return false;
//     }
//     return true;
//   }
// 
//   @Override
//   public int hashCode() {
//     return super.hashCode();
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/events/RefReplicationDoneEvent.java
// public class RefReplicationDoneEvent extends RefEvent {
//   public static final String TYPE = "ref-replication-done";
// 
//   final String project;
//   final String ref;
//   final int nodesCount;
// 
//   public RefReplicationDoneEvent(String project, String ref, int nodesCount) {
//     super(TYPE);
//     this.project = project;
//     this.ref = ref;
//     this.nodesCount = nodesCount;
//   }
// 
//   @Override
//   public Project.NameKey getProjectNameKey() {
//     return Project.nameKey(project);
//   }
// 
//   @Override
//   public String getRefName() {
//     return ref;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof RefReplicationDoneEvent)) {
//       return false;
//     }
// 
//     RefReplicationDoneEvent event = (RefReplicationDoneEvent) other;
//     if (!Objects.equals(event.project, this.project)) {
//       return false;
//     }
//     if (!Objects.equals(event.ref, this.ref)) {
//       return false;
//     }
//     if (event.nodesCount != this.nodesCount) {
//       return false;
//     }
//     return true;
//   }
// 
//   @Override
//   public int hashCode() {
//     return super.hashCode();
//   }
// }


import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import com.google.gerrit.server.events.EventDispatcher;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.googlesource.gerrit.plugins.replication.PushResultProcessing.GitUpdateProcessing;
import com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult;
import com.googlesource.gerrit.plugins.replication.events.RefReplicatedEvent;
import com.googlesource.gerrit.plugins.replication.events.RefReplicationDoneEvent;
import java.net.URISyntaxException;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.URIish;
import org.junit.Before;
import org.junit.Test;
// Copyright (C) 2013 The Android Open Source Project
//
// 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 com.googlesource.gerrit.plugins.replication;



public class GitUpdateProcessingTest {
  private EventDispatcher dispatcherMock;
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/PushResultProcessing.java
// public static class GitUpdateProcessing implements PushResultProcessing {
//   private static final FluentLogger logger = FluentLogger.forEnclosingClass();
// 
//   private final EventDispatcher dispatcher;
// 
//   public GitUpdateProcessing(EventDispatcher dispatcher) {
//     this.dispatcher = dispatcher;
//   }
// 
//   @Override
//   public void onRefReplicatedToOneNode(
//       String project,
//       String ref,
//       URIish uri,
//       RefPushResult status,
//       RemoteRefUpdate.Status refStatus) {
//     postEvent(new RefReplicatedEvent(project, ref, uri, status, refStatus));
//   }
// 
//   @Override
//   public void onRefReplicatedToAllNodes(String project, String ref, int nodesCount) {
//     postEvent(new RefReplicationDoneEvent(project, ref, nodesCount));
//   }
// 
//   private void postEvent(RefEvent event) {
//     try {
//       dispatcher.postEvent(event);
//     } catch (StorageException | PermissionBackendException e) {
//       logger.atSevere().withCause(e).log("Cannot post event");
//     }
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java
// public enum RefPushResult {
//   /** The ref was not successfully replicated. */
//   FAILED,
// 
//   /** The ref is not configured to be replicated. */
//   NOT_ATTEMPTED,
// 
//   /** The ref was successfully replicated. */
//   SUCCEEDED;
// 
//   @Override
//   public String toString() {
//     return name().toLowerCase().replace("_", "-");
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/events/RefReplicatedEvent.java
// public class RefReplicatedEvent extends RemoteRefReplicationEvent {
//   public static final String TYPE = "ref-replicated";
// 
//   @Deprecated public final String targetNode;
//   public final Status refStatus;
// 
//   public RefReplicatedEvent(
//       String project,
//       String ref,
//       URIish targetUri,
//       RefPushResult status,
//       RemoteRefUpdate.Status refStatus) {
//     super(TYPE, project, ref, targetUri, status.toString());
//     this.targetNode = resolveNodeName(targetUri);
//     this.refStatus = refStatus;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof RefReplicatedEvent)) {
//       return false;
//     }
//     RefReplicatedEvent event = (RefReplicatedEvent) other;
//     if (!Objects.equals(event.project, this.project)) {
//       return false;
//     }
//     if (!Objects.equals(event.ref, this.ref)) {
//       return false;
//     }
//     if (!Objects.equals(event.targetNode, this.targetNode)) {
//       return false;
//     }
//     if (!Objects.equals(event.targetUri, this.targetUri)) {
//       return false;
//     }
//     if (!Objects.equals(event.status, this.status)) {
//       return false;
//     }
//     if (!Objects.equals(event.refStatus, this.refStatus)) {
//       return false;
//     }
//     return true;
//   }
// 
//   @Override
//   public int hashCode() {
//     return super.hashCode();
//   }
// }
// 
// Path: src/main/java/com/googlesource/gerrit/plugins/replication/events/RefReplicationDoneEvent.java
// public class RefReplicationDoneEvent extends RefEvent {
//   public static final String TYPE = "ref-replication-done";
// 
//   final String project;
//   final String ref;
//   final int nodesCount;
// 
//   public RefReplicationDoneEvent(String project, String ref, int nodesCount) {
//     super(TYPE);
//     this.project = project;
//     this.ref = ref;
//     this.nodesCount = nodesCount;
//   }
// 
//   @Override
//   public Project.NameKey getProjectNameKey() {
//     return Project.nameKey(project);
//   }
// 
//   @Override
//   public String getRefName() {
//     return ref;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof RefReplicationDoneEvent)) {
//       return false;
//     }
// 
//     RefReplicationDoneEvent event = (RefReplicationDoneEvent) other;
//     if (!Objects.equals(event.project, this.project)) {
//       return false;
//     }
//     if (!Objects.equals(event.ref, this.ref)) {
//       return false;
//     }
//     if (event.nodesCount != this.nodesCount) {
//       return false;
//     }
//     return true;
//   }
// 
//   @Override
//   public int hashCode() {
//     return super.hashCode();
//   }
// }


// Path: src/test/java/com/googlesource/gerrit/plugins/replication/GitUpdateProcessingTest.java
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import com.google.gerrit.server.events.EventDispatcher;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.googlesource.gerrit.plugins.replication.PushResultProcessing.GitUpdateProcessing;
import com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult;
import com.googlesource.gerrit.plugins.replication.events.RefReplicatedEvent;
import com.googlesource.gerrit.plugins.replication.events.RefReplicationDoneEvent;
import java.net.URISyntaxException;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.URIish;
import org.junit.Before;
import org.junit.Test;

// Copyright (C) 2013 The Android Open Source Project
//
// 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 com.googlesource.gerrit.plugins.replication;



public class GitUpdateProcessingTest {
  private EventDispatcher dispatcherMock;
  private GitUpdateProcessing gitUpdateProcessing;