Browse Source

DATACMNS-414 - Adapted to removed generics in AuditingHandler API.

pull/82/merge
Oliver Gierke 12 years ago
parent
commit
e9c8644d23
  1. 6
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListener.java
  2. 9
      spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java

6
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListener.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,14 +28,14 @@ import org.springframework.util.Assert;
*/ */
public class AuditingEventListener implements ApplicationListener<BeforeConvertEvent<Object>> { public class AuditingEventListener implements ApplicationListener<BeforeConvertEvent<Object>> {
private final IsNewAwareAuditingHandler<Object> auditingHandler; private final IsNewAwareAuditingHandler auditingHandler;
/** /**
* Creates a new {@link AuditingEventListener} using the given {@link MappingContext} and {@link AuditingHandler}. * Creates a new {@link AuditingEventListener} using the given {@link MappingContext} and {@link AuditingHandler}.
* *
* @param auditingHandler must not be {@literal null}. * @param auditingHandler must not be {@literal null}.
*/ */
public AuditingEventListener(IsNewAwareAuditingHandler<Object> auditingHandler) { public AuditingEventListener(IsNewAwareAuditingHandler auditingHandler) {
Assert.notNull(auditingHandler, "IsNewAwareAuditingHandler must not be null!"); Assert.notNull(auditingHandler, "IsNewAwareAuditingHandler must not be null!");
this.auditingHandler = auditingHandler; this.auditingHandler = auditingHandler;

9
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/AuditingEventListenerUnitTests.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -37,7 +37,7 @@ import org.springframework.data.support.IsNewStrategyFactory;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class AuditingEventListenerUnitTests { public class AuditingEventListenerUnitTests {
IsNewAwareAuditingHandler<Object> handler; IsNewAwareAuditingHandler handler;
IsNewStrategyFactory factory; IsNewStrategyFactory factory;
AuditingEventListener listener; AuditingEventListener listener;
@ -48,7 +48,7 @@ public class AuditingEventListenerUnitTests {
MongoMappingContext mappingContext = new MongoMappingContext(); MongoMappingContext mappingContext = new MongoMappingContext();
factory = new MappingContextIsNewStrategyFactory(mappingContext); factory = new MappingContextIsNewStrategyFactory(mappingContext);
handler = spy(new IsNewAwareAuditingHandler<Object>(factory)); handler = spy(new IsNewAwareAuditingHandler(factory));
doNothing().when(handler).markCreated(Mockito.any(Object.class)); doNothing().when(handler).markCreated(Mockito.any(Object.class));
doNothing().when(handler).markModified(Mockito.any(Object.class)); doNothing().when(handler).markModified(Mockito.any(Object.class));
@ -83,7 +83,6 @@ public class AuditingEventListenerUnitTests {
static class Sample { static class Sample {
@Id @Id String id;
String id;
} }
} }

Loading…
Cancel
Save