@Test
  @FixFor("MODE-2109")
  public void shouldOnlyAllowCopyingInSomeCases() throws Exception {
    session.getWorkspace().createWorkspace("other");

    try {
      session.getRootNode().addNode("col1", "test:smallCollection");
      Node regular = session.getRootNode().addNode("regular");
      regular.addNode("regular1");
      session.save();

      // cloning a large collection is not allowed
      JcrWorkspace workspace = session.getWorkspace();
      try {
        workspace.copy("/col1", "/col3");
        fail("Should not allow copying");
      } catch (ConstraintViolationException e) {
        // expected
      }

      // copy a regular node into a large collection into this ws
      workspace.copy("/regular", "/col1/regular");
      NodeIterator nodes = session.getNode("/col1").getNodes();
      assertEquals(1, nodes.getSize());

      JcrSession otherSession = repository.login("other");
      Node col2 = otherSession.getRootNode().addNode("col2", "test:smallCollection");
      col2.addNode("child1");
      otherSession.save();

      // copy a regular node into a large collection into another ws
      otherSession.getWorkspace().copy(workspace.getName(), "/regular", "/col2/regular");
      nodes = otherSession.getNode("/col2").getNodes();
      assertEquals(2, nodes.getSize());
    } finally {
      session.getWorkspace().deleteWorkspace("other");
    }
  }