blob: d3d2542a3e51747644d12968ea2ca7f416e3f7c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*******************************************************************************
* Copyright (c) 2010 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.framework.access.test.mocks;
import java.util.Collection;
import org.eclipse.osee.framework.core.data.AccessContextId;
import org.eclipse.osee.framework.core.model.IBasicArtifact;
import org.eclipse.osee.framework.core.services.CmAccessControl;
import org.junit.Assert;
/**
* @author Roberto E. Escobar
*/
public class MockConfigurationManagement implements CmAccessControl {
private final IBasicArtifact<?> expectedUser;
private final Object expectedObject;
private final boolean isApplicable;
private final Collection<AccessContextId> contextIds;
private boolean wasIsApplicableCalled;
private boolean wasGetContextIdCalled;
public MockConfigurationManagement(IBasicArtifact<?> expectedUser, Object expectedObject, boolean isApplicable, Collection<AccessContextId> contextIds) {
super();
this.expectedUser = expectedUser;
this.expectedObject = expectedObject;
this.isApplicable = isApplicable;
this.contextIds = contextIds;
}
@Override
public boolean isApplicable(IBasicArtifact<?> user, Object object) {
wasIsApplicableCalled = true;
Assert.assertEquals(expectedUser, user);
Assert.assertEquals(expectedObject, object);
return isApplicable;
}
@Override
public Collection<AccessContextId> getContextId(IBasicArtifact<?> user, Object object) {
wasGetContextIdCalled = true;
Assert.assertEquals(expectedUser, user);
Assert.assertEquals(expectedObject, object);
return contextIds;
}
public boolean wasIsApplicableCalled() {
return wasIsApplicableCalled;
}
public boolean wasGetContextIdCalled() {
return wasGetContextIdCalled;
}
}
|