mitreid-connect
公開メンバ関数 | 非公開変数類 | 全メンバ一覧
org.mitre.oauth2.service.impl.TestDefaultSystemScopeService クラス
org.mitre.oauth2.service.impl.TestDefaultSystemScopeService 連携図
Collaboration graph

公開メンバ関数

void prepare ()
 
void getAll ()
 
void getDefaults ()
 
void getUnrestricted ()
 
void getRestricted ()
 
void fromStrings ()
 
void toStrings ()
 
void scopesMatch ()
 

非公開変数類

SystemScope defaultDynScope1
 
SystemScope defaultDynScope2
 
SystemScope defaultScope1
 
SystemScope defaultScope2
 
SystemScope dynScope1
 
SystemScope restrictedScope1
 
String defaultDynScope1String = "defaultDynScope1"
 
String defaultDynScope2String = "defaultDynScope2"
 
String defaultScope1String = "defaultScope1"
 
String defaultScope2String = "defaultScope2"
 
String dynScope1String = "dynScope1"
 
String restrictedScope1String = "restrictedScope1"
 
Set< SystemScopeallScopes
 
Set< String > allScopeStrings
 
Set< SystemScopeallScopesWithValue
 
Set< String > allScopeStringsWithValue
 
SystemScopeRepository repository
 
DefaultSystemScopeService service
 

詳解

著者
wkim

関数詳解

◆ fromStrings()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.fromStrings ( )
inline
150  {
151 
152  // check null condition
153  assertThat(service.fromStrings(null), is(nullValue()));
154 
155  assertThat(service.fromStrings(allScopeStrings), equalTo(allScopes));
156 
158  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
Set< SystemScope > allScopesWithValue
Definition: TestDefaultSystemScopeService.java:64
Set< SystemScope > fromStrings(Set< String > scope)
Definition: DefaultSystemScopeService.java:148
Set< String > allScopeStringsWithValue
Definition: TestDefaultSystemScopeService.java:65
Set< String > allScopeStrings
Definition: TestDefaultSystemScopeService.java:63
Set< SystemScope > allScopes
Definition: TestDefaultSystemScopeService.java:62

◆ getAll()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.getAll ( )
inline
120  {
121 
122  assertThat(service.getAll(), equalTo(allScopes));
123  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
Set< SystemScope > allScopes
Definition: TestDefaultSystemScopeService.java:62
Set< SystemScope > getAll()
Definition: DefaultSystemScopeService.java:103

◆ getDefaults()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.getDefaults ( )
inline
126  {
127 
128  Set<SystemScope> defaults = Sets.newHashSet(defaultDynScope1, defaultDynScope2, defaultScope1, defaultScope2);
129 
130  assertThat(service.getDefaults(), equalTo(defaults));
131  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
SystemScope defaultScope1
Definition: TestDefaultSystemScopeService.java:50
SystemScope defaultScope2
Definition: TestDefaultSystemScopeService.java:51
SystemScope defaultDynScope2
Definition: TestDefaultSystemScopeService.java:49
SystemScope defaultDynScope1
Definition: TestDefaultSystemScopeService.java:48
Set< SystemScope > getDefaults()
Definition: DefaultSystemScopeService.java:192

◆ getRestricted()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.getRestricted ( )
inline
142  {
143  Set<SystemScope> restricted = Sets.newHashSet(defaultScope1, defaultScope2, restrictedScope1);
144 
145  assertThat(service.getRestricted(), equalTo(restricted));
146 
147  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
SystemScope defaultScope1
Definition: TestDefaultSystemScopeService.java:50
SystemScope restrictedScope1
Definition: TestDefaultSystemScopeService.java:53
SystemScope defaultScope2
Definition: TestDefaultSystemScopeService.java:51
Set< SystemScope > getRestricted()
Definition: DefaultSystemScopeService.java:203

◆ getUnrestricted()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.getUnrestricted ( )
inline
134  {
135 
136  Set<SystemScope> unrestricted = Sets.newHashSet(defaultDynScope1, defaultDynScope2, dynScope1);
137 
138  assertThat(service.getUnrestricted(), equalTo(unrestricted));
139  }
Set< SystemScope > getUnrestricted()
Definition: DefaultSystemScopeService.java:208
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
SystemScope defaultDynScope2
Definition: TestDefaultSystemScopeService.java:49
SystemScope dynScope1
Definition: TestDefaultSystemScopeService.java:52
SystemScope defaultDynScope1
Definition: TestDefaultSystemScopeService.java:48

◆ prepare()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.prepare ( )
inline

Assumes these SystemScope defaults: isDefaultScope=false and isAllowDynReg=false.

77  {
78 
79  Mockito.reset(repository);
80 
81  // two default and dynamically registerable scopes (unrestricted)
82  defaultDynScope1 = new SystemScope(defaultDynScope1String);
83  defaultDynScope2 = new SystemScope(defaultDynScope2String);
86 
87  // two strictly default scopes (restricted)
88  defaultScope1 = new SystemScope(defaultScope1String);
89  defaultScope2 = new SystemScope(defaultScope2String);
94 
95  // one strictly dynamically registerable scope (isDefault false)
96  dynScope1 = new SystemScope(dynScope1String);
97 
98  // extraScope1 : extra scope that is neither restricted nor default (defaults to false/false)
99  restrictedScope1 = new SystemScope(restrictedScope1String);
101 
102 
105 
108 
111  Mockito.when(repository.getByValue(defaultScope1String)).thenReturn(defaultScope1);
112  Mockito.when(repository.getByValue(defaultScope2String)).thenReturn(defaultScope2);
113  Mockito.when(repository.getByValue(dynScope1String)).thenReturn(dynScope1);
115 
116  Mockito.when(repository.getAll()).thenReturn(allScopes);
117  }
String defaultScope2String
Definition: TestDefaultSystemScopeService.java:58
SystemScopeRepository repository
Definition: TestDefaultSystemScopeService.java:68
SystemScope defaultScope1
Definition: TestDefaultSystemScopeService.java:50
SystemScope restrictedScope1
Definition: TestDefaultSystemScopeService.java:53
SystemScope defaultScope2
Definition: TestDefaultSystemScopeService.java:51
String defaultScope1String
Definition: TestDefaultSystemScopeService.java:57
String dynScope1String
Definition: TestDefaultSystemScopeService.java:59
String defaultDynScope1String
Definition: TestDefaultSystemScopeService.java:55
Set< SystemScope > allScopesWithValue
Definition: TestDefaultSystemScopeService.java:64
SystemScope defaultDynScope2
Definition: TestDefaultSystemScopeService.java:49
void setRestricted(boolean restricted)
Definition: SystemScope.java:158
SystemScope dynScope1
Definition: TestDefaultSystemScopeService.java:52
SystemScope defaultDynScope1
Definition: TestDefaultSystemScopeService.java:48
void setDefaultScope(boolean defaultScope)
Definition: SystemScope.java:142
Set< String > allScopeStringsWithValue
Definition: TestDefaultSystemScopeService.java:65
String restrictedScope1String
Definition: TestDefaultSystemScopeService.java:60
Set< String > allScopeStrings
Definition: TestDefaultSystemScopeService.java:63
String defaultDynScope2String
Definition: TestDefaultSystemScopeService.java:56
Set< SystemScope > allScopes
Definition: TestDefaultSystemScopeService.java:62

◆ scopesMatch()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.scopesMatch ( )
inline
172  {
173 
174  Set<String> expected = Sets.newHashSet("foo", "bar", "baz");
175  Set<String> actualGood = Sets.newHashSet("foo", "baz", "bar");
176  Set<String> actualGood2 = Sets.newHashSet("foo", "bar");
177  Set<String> actualBad = Sets.newHashSet("foo", "bob", "bar");
178 
179  // same scopes, different order
180  assertThat(service.scopesMatch(expected, actualGood), is(true));
181 
182  // subset
183  assertThat(service.scopesMatch(expected, actualGood2), is(true));
184 
185  // extra scope (fail)
186  assertThat(service.scopesMatch(expected, actualBad), is(false));
187  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
boolean scopesMatch(Set< String > expected, Set< String > actual)
Definition: DefaultSystemScopeService.java:172

◆ toStrings()

void org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.toStrings ( )
inline
161  {
162 
163  // check null condition
164  assertThat(service.toStrings(null), is(nullValue()));
165 
166  assertThat(service.toStrings(allScopes), equalTo(allScopeStrings));
167 
169  }
DefaultSystemScopeService service
Definition: TestDefaultSystemScopeService.java:71
Set< String > toStrings(Set< SystemScope > scope)
Definition: DefaultSystemScopeService.java:160
Set< SystemScope > allScopesWithValue
Definition: TestDefaultSystemScopeService.java:64
Set< String > allScopeStringsWithValue
Definition: TestDefaultSystemScopeService.java:65
Set< String > allScopeStrings
Definition: TestDefaultSystemScopeService.java:63
Set< SystemScope > allScopes
Definition: TestDefaultSystemScopeService.java:62

メンバ詳解

◆ allScopes

Set<SystemScope> org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.allScopes
private

◆ allScopeStrings

Set<String> org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.allScopeStrings
private

◆ allScopeStringsWithValue

Set<String> org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.allScopeStringsWithValue
private

◆ allScopesWithValue

Set<SystemScope> org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.allScopesWithValue
private

◆ defaultDynScope1

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultDynScope1
private

◆ defaultDynScope1String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultDynScope1String = "defaultDynScope1"
private

◆ defaultDynScope2

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultDynScope2
private

◆ defaultDynScope2String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultDynScope2String = "defaultDynScope2"
private

◆ defaultScope1

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultScope1
private

◆ defaultScope1String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultScope1String = "defaultScope1"
private

◆ defaultScope2

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultScope2
private

◆ defaultScope2String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.defaultScope2String = "defaultScope2"
private

◆ dynScope1

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.dynScope1
private

◆ dynScope1String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.dynScope1String = "dynScope1"
private

◆ repository

SystemScopeRepository org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.repository
private

◆ restrictedScope1

SystemScope org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.restrictedScope1
private

◆ restrictedScope1String

String org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.restrictedScope1String = "restrictedScope1"
private

◆ service

DefaultSystemScopeService org.mitre.oauth2.service.impl.TestDefaultSystemScopeService.service
private

このクラス詳解は次のファイルから抽出されました: