@Test public void testGetRecordingOperation_Rename() throws Exception { CompensatingTransactionOperationRecorder result = tested .createRecordingOperation(dirContextMock, "rename"); assertThat(result instanceof RenameOperationRecorder).isTrue(); RenameOperationRecorder recordingOperation = (RenameOperationRecorder) result; assertThat(recordingOperation.getLdapOperations()).isSameAs(ldapOperationsMock); }
public CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation) { if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.BIND_METHOD_NAME)) { log.debug("Bind operation recorded"); return new BindOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.REBIND_METHOD_NAME)) { log.debug("Rebind operation recorded"); return new RebindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.RENAME_METHOD_NAME)) { log.debug("Rename operation recorded"); return new RenameOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.MODIFY_ATTRIBUTES_METHOD_NAME)) { return new ModifyAttributesOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.UNBIND_METHOD_NAME)) { return new UnbindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } log.warn("No suitable CompensatingTransactionOperationRecorder found for method " + operation + ". Operation will not be transacted."); return new NullOperationRecorder(); }
LdapCompensatingTransactionOperationFactory implements CompensatingTransactionOperationFactory { public CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation) { if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.BIND_METHOD_NAME)) { log.debug("Bind operation recorded"); return new BindOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.REBIND_METHOD_NAME)) { log.debug("Rebind operation recorded"); return new RebindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.RENAME_METHOD_NAME)) { log.debug("Rename operation recorded"); return new RenameOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.MODIFY_ATTRIBUTES_METHOD_NAME)) { return new ModifyAttributesOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.UNBIND_METHOD_NAME)) { return new UnbindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } log.warn("No suitable CompensatingTransactionOperationRecorder found for method " + operation + ". Operation will not be transacted."); return new NullOperationRecorder(); } }
LdapCompensatingTransactionOperationFactory implements CompensatingTransactionOperationFactory { public CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation) { if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.BIND_METHOD_NAME)) { log.debug("Bind operation recorded"); return new BindOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.REBIND_METHOD_NAME)) { log.debug("Rebind operation recorded"); return new RebindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.RENAME_METHOD_NAME)) { log.debug("Rename operation recorded"); return new RenameOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.MODIFY_ATTRIBUTES_METHOD_NAME)) { return new ModifyAttributesOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.UNBIND_METHOD_NAME)) { return new UnbindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } log.warn("No suitable CompensatingTransactionOperationRecorder found for method " + operation + ". Operation will not be transacted."); return new NullOperationRecorder(); } LdapCompensatingTransactionOperationFactory(TempEntryRenamingStrategy renamingStrategy); }
LdapCompensatingTransactionOperationFactory implements CompensatingTransactionOperationFactory { public CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation) { if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.BIND_METHOD_NAME)) { log.debug("Bind operation recorded"); return new BindOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.REBIND_METHOD_NAME)) { log.debug("Rebind operation recorded"); return new RebindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.RENAME_METHOD_NAME)) { log.debug("Rename operation recorded"); return new RenameOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.MODIFY_ATTRIBUTES_METHOD_NAME)) { return new ModifyAttributesOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.UNBIND_METHOD_NAME)) { return new UnbindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } log.warn("No suitable CompensatingTransactionOperationRecorder found for method " + operation + ". Operation will not be transacted."); return new NullOperationRecorder(); } LdapCompensatingTransactionOperationFactory(TempEntryRenamingStrategy renamingStrategy); CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation); }
LdapCompensatingTransactionOperationFactory implements CompensatingTransactionOperationFactory { public CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation) { if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.BIND_METHOD_NAME)) { log.debug("Bind operation recorded"); return new BindOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.REBIND_METHOD_NAME)) { log.debug("Rebind operation recorded"); return new RebindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.RENAME_METHOD_NAME)) { log.debug("Rename operation recorded"); return new RenameOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.MODIFY_ATTRIBUTES_METHOD_NAME)) { return new ModifyAttributesOperationRecorder(createLdapOperationsInstance((DirContext) resource)); } else if (ObjectUtils.nullSafeEquals(operation, LdapTransactionUtils.UNBIND_METHOD_NAME)) { return new UnbindOperationRecorder(createLdapOperationsInstance((DirContext) resource), renamingStrategy); } log.warn("No suitable CompensatingTransactionOperationRecorder found for method " + operation + ". Operation will not be transacted."); return new NullOperationRecorder(); } LdapCompensatingTransactionOperationFactory(TempEntryRenamingStrategy renamingStrategy); CompensatingTransactionOperationRecorder createRecordingOperation(Object resource, String operation);  }