Project

General

Profile

« Previous | Next » 

Revision 07314c9f

Added by Niels Hoffmann over 14 years ago

user get correctly saved in UserService as of now

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/UserService.java
315 315
	
316 316
	@Transactional(readOnly=false)
317 317
	public UUID save(User user) {
318
		return dao.save(user);
318
		if(user.getId() == 0 || dao.load(user.getUuid()) == null){
319
			createUser(user);
320
		}
321
		updateUser(user);
322
		
323
		return user.getUuid(); 
324
//		return dao.save(user);
325
	}
326

  
327
	@Override
328
	public UUID update(User user) {
329
		updateUser(user);
330
		return user.getUuid(); 
319 331
	}
320 332

  
321 333
	@Transactional(readOnly=false)
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/UserServiceImplTest.java
10 10
import org.springframework.security.Authentication;
11 11
import org.springframework.security.AuthenticationManager;
12 12
import org.springframework.security.GrantedAuthority;
13
import org.springframework.security.context.SecurityContextHolder;
13 14
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
14
import org.springframework.security.userdetails.UserDetails;
15 15
import org.unitils.dbunit.annotation.DataSet;
16 16
import org.unitils.spring.annotation.SpringBeanByType;
17 17

  
......
76 76
		String password = "password";
77 77
		User user = User.NewInstance(username, password);
78 78
		
79
		userService.createUser(user);
79
		userService.save(user);
80
		
81
//		userService.createUser(user);
80 82
		
81 83
		
82 84
		
83 85
		UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(username, password);
84 86
		
85 87
		authenticationManager.authenticate(token);
86
		
87 88
	}
88 89
}

Also available in: Unified diff