source: ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/DummyPrincipal.java @ 5561

Last change on this file since 5561 was 1892, checked in by twagoo, 12 years ago

Added canDelete property to Comment
ComponentRegistryDbImpl? sets property for all returned comments based on current principal
Comment retrieval methods of ComponentRegistry interface now require principal as parameter

Tests modified and extended

File size: 953 bytes
Line 
1package clarin.cmdi.componentregistry.rest;
2
3import java.security.Principal;
4
5import clarin.cmdi.componentregistry.UserCredentials;
6
7public final class DummyPrincipal implements Principal {
8
9    public static final DummyPrincipal DUMMY_ADMIN_PRINCIPAL = new DummyPrincipal("JUnit.Admin@test.com");
10    public static final DummyPrincipal DUMMY_PRINCIPAL = new DummyPrincipal("JUnit@test.com");
11    public static final UserCredentials DUMMY_CREDENTIALS = new UserCredentials(DUMMY_PRINCIPAL) {
12
13        @Override
14        public String getDisplayName() {
15            return "J.Unit";
16        }
17    };
18    public static final UserCredentials DUMMY_ADMIN_CREDENTIALS = new UserCredentials(DUMMY_ADMIN_PRINCIPAL);
19    private final String username;
20
21    public DummyPrincipal(String username) {
22        this.username = username;
23    }
24
25    @Override
26    public String getName() {
27        return username;
28    }
29
30    public UserCredentials getCredentials() {
31        return new UserCredentials(this);
32    }
33}
Note: See TracBrowser for help on using the repository browser.