@Override
  public SCMUploaderNotifyResponse notify(SCMUploaderNotifyRequest request)
      throws YarnException, IOException {
    SCMUploaderNotifyResponse response =
        recordFactory.newRecordInstance(SCMUploaderNotifyResponse.class);

    // TODO (YARN-2774): proper security/authorization needs to be implemented

    String filename =
        store.addResource(request.getResourceKey(), request.getFileName());

    boolean accepted = filename.equals(request.getFileName());

    if (accepted) {
      this.metrics.incAcceptedUploads();
    } else {
      this.metrics.incRejectedUploads();
    }

    response.setAccepted(accepted);

    return response;
  }
@Test
  void testNotify_entryExists_differentName() throws Exception {

    long rejected =
        SharedCacheUploaderMetrics.getInstance().getRejectUploads();

    store.addResource("key1", "foo.jar");
    SCMUploaderNotifyRequest request =
        recordFactory.newRecordInstance(SCMUploaderNotifyRequest.class);
    request.setResourceKey("key1");
    request.setFilename("foobar.jar");
    assertFalse(proxy.notify(request).getAccepted());
    Collection<SharedCacheResourceReference> set =
        store.getResourceReferences("key1");
    assertNotNull(set);
    assertEquals(0, set.size());
    assertEquals(
        1,
        SharedCacheUploaderMetrics.getInstance().getRejectUploads() -
            rejected,
        "NM upload metrics aren't updated.");

  }