Changeset 5836 for DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBDispatcherTest.java
- Timestamp:
- 11/18/14 17:52:24 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBDispatcherTest.java
r5774 r5836 344 344 will(returnValue(mockAnnotationIDs1)); 345 345 346 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.READ);346 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.READ); 347 347 will(returnValue(mockAnnotationIDsRead)); 348 348 349 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.READ);349 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.READ); 350 350 will(returnValue(mockAnnotationIDsPublicRead)); 351 351 … … 418 418 will(returnValue(mockAnnotationIDs1)); 419 419 420 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.READ);420 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.READ); 421 421 will(returnValue(mockAnnotationIDsRead)); 422 422 423 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.READ);423 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.READ); 424 424 will(returnValue(mockAnnotationIDsPublicRead)); 425 425 … … 491 491 will(returnValue(mockAnnotationIDs1)); 492 492 493 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.READ);493 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.READ); 494 494 will(returnValue(mockAnnotationIDsRead)); 495 495 496 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.READ);496 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.READ); 497 497 will(returnValue(mockAnnotationIDsPublicRead)); 498 498 … … 565 565 will(returnValue(mockAnnotationIDs1)); 566 566 567 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.READ);567 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.READ); 568 568 will(returnValue(mockAnnotationIDsRead)); 569 569 570 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.READ);570 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.READ); 571 571 will(returnValue(mockAnnotationIDsPublicRead)); 572 572 … … 631 631 will(returnValue(mockAnnotationIDs1)); 632 632 633 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.WRITE);633 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.WRITE); 634 634 will(returnValue(mockAnnotationIDsWrite)); 635 635 636 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.WRITE);636 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.WRITE); 637 637 will(returnValue(mockAnnotationIDsPublicWrite)); 638 638 … … 695 695 will(returnValue(mockAnnotationIDs1)); 696 696 697 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.WRITE);697 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.WRITE); 698 698 will(returnValue(mockAnnotationIDsWrite)); 699 699 700 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.WRITE);700 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.WRITE); 701 701 will(returnValue(mockAnnotationIDsPublicWrite)); 702 702 … … 761 761 will(returnValue(mockAnnotationIDs1)); 762 762 763 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.WRITE);763 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.WRITE); 764 764 will(returnValue(mockAnnotationIDsWrite)); 765 765 766 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.WRITE);766 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.WRITE); 767 767 will(returnValue(mockAnnotationIDsPublicWrite)); 768 768 … … 826 826 will(returnValue(mockAnnotationIDs1)); 827 827 828 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.WRITE);828 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.WRITE); 829 829 will(returnValue(mockAnnotationIDsWrite)); 830 830 831 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.WRITE);831 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.WRITE); 832 832 will(returnValue(mockAnnotationIDsPublicWrite)); 833 833 … … 1021 1021 will(returnValue(mockAnnotationIDs1)); 1022 1022 1023 oneOf(annotationDao).getAnnotationIDs ForPermission(loggedIn, Access.READ);1023 oneOf(annotationDao).getAnnotationIDsPermissionAtLeast(loggedIn, Access.READ); 1024 1024 will(returnValue(mockAnnotationIDsRead)); 1025 1025 1026 oneOf(annotationDao).getAnnotationIDs ForPublicAccess(Access.READ);1026 oneOf(annotationDao).getAnnotationIDsPublicAtLeast(Access.READ); 1027 1027 will(returnValue(mockAnnotationIDsPublicRead)); 1028 1028 … … 1258 1258 will(returnValue(1)); // the DB update will be called at perform anyway, even if the body is not changed (can be optimized) 1259 1259 1260 oneOf(annotationDao).updatePublicA ttribute(5, Access.WRITE);1260 oneOf(annotationDao).updatePublicAccess(5, Access.WRITE); 1261 1261 will(returnValue(1)); 1262 1262 } … … 1414 1414 mockeryDao.checking(new Expectations() { 1415 1415 { 1416 oneOf(annotationDao).delete AnnotationPermissions(2);1416 oneOf(annotationDao).deletePermissions(2); 1417 1417 will(returnValue(2)); 1418 1418 … … 1767 1767 will(returnValue("/api/principals/00000000-0000-0000-0000-000000000113")); 1768 1768 1769 1769 oneOf(principalDao).getPrincipalIDsWithAccessForNotebook(2, Access.ALL); 1770 will(returnValue(new ArrayList<Number>())); 1770 1771 1771 1772 } … … 1952 1953 will(returnValue(1)); // the DB update will be called at perform anyway, even if the body is not changed (can be optimized) 1953 1954 1954 oneOf(annotationDao).updatePublicA ttribute(5, Access.WRITE);1955 oneOf(annotationDao).updatePublicAccess(5, Access.WRITE); 1955 1956 will(returnValue(1)); 1956 1957 … … 2110 2111 will(returnValue(1)); 2111 2112 2112 oneOf(annotationDao).delete AnnotationPermissions(1);2113 oneOf(annotationDao).deletePermissions(1); 2113 2114 will(returnValue(3)); 2114 2115 … … 2144 2145 will(returnValue(2)); 2145 2146 2146 oneOf(annotationDao).add AnnotationPrincipalAccess(1, 2, Access.WRITE);2147 oneOf(annotationDao).addPermission(1, 2, Access.WRITE); 2147 2148 will(returnValue(1)); 2148 2149 … … 2150 2151 will(returnValue(3)); 2151 2152 2152 oneOf(annotationDao).add AnnotationPrincipalAccess(1, 3, Access.READ);2153 oneOf(annotationDao).addPermission(1, 3, Access.READ); 2153 2154 will(returnValue(1)); 2154 2155 … … 2161 2162 /// 2162 2163 2163 oneOf(annotationDao).updatePublicA ttribute(1, permissions.getPublic());2164 oneOf(annotationDao).updatePublicAccess(1, permissions.getPublic()); 2164 2165 will(returnValue(1)); 2165 2166 … … 2200 2201 // } 2201 2202 @Test 2202 public void testUpdate AnnotationPrinciaplAccess() {2203 public void testUpdatePermission() { 2203 2204 System.out.println("test updateAnnotationPrincipalAccess"); 2204 2205 mockeryDao.checking(new Expectations() { 2205 2206 { 2206 oneOf(annotationDao). getAccess(1, 2);2207 will(returnValue( Access.WRITE));2208 2209 oneOf(annotationDao).update AnnotationPrincipalAccess(1, 2, Access.READ);2210 will(returnValue(1)); 2211 2212 oneOf(annotationDao). getAccess(1, 4);2213 will(returnValue( null));2214 2215 oneOf(annotationDao).add AnnotationPrincipalAccess(1, 4, Access.WRITE);2216 will(returnValue(1)); 2217 2218 } 2219 }); 2220 2221 assertEquals(1, dbDispatcher.update AnnotationPrincipalAccess(1, 2, Access.READ));2222 assertEquals(1, dbDispatcher.update AnnotationPrincipalAccess(1, 4, Access.WRITE));2207 oneOf(annotationDao).hasExplicitAccess(1, 2); 2208 will(returnValue(true)); 2209 2210 oneOf(annotationDao).updatePermission(1, 2, Access.READ); 2211 will(returnValue(1)); 2212 2213 oneOf(annotationDao).hasExplicitAccess(1, 4); 2214 will(returnValue(false)); 2215 2216 oneOf(annotationDao).addPermission(1, 4, Access.WRITE); 2217 will(returnValue(1)); 2218 2219 } 2220 }); 2221 2222 assertEquals(1, dbDispatcher.updatePermission(1, 2, Access.READ)); 2223 assertEquals(1, dbDispatcher.updatePermission(1, 4, Access.WRITE)); 2223 2224 } 2224 2225 … … 2249 2250 { 2250 2251 ///// 2251 oneOf(annotationDao).updatePublicA ttribute(1, permissions.getPublic());2252 oneOf(annotationDao).updatePublicAccess(1, permissions.getPublic()); 2252 2253 will(returnValue(1)); 2253 2254 … … 2255 2256 will(returnValue(2)); 2256 2257 2257 oneOf(annotationDao). getAccess(1, 2);2258 will(returnValue( Access.WRITE));2258 oneOf(annotationDao).hasExplicitAccess(1, 2); 2259 will(returnValue(true)); 2259 2260 2260 2261 oneOf(principalDao).getInternalIDFromHref(permissions.getPermission().get(1).getPrincipalHref()); 2261 2262 will(returnValue(3)); 2262 2263 2263 oneOf(annotationDao). getAccess(1, 3);2264 will(returnValue( Access.WRITE));2264 oneOf(annotationDao).hasExplicitAccess(1, 3); 2265 will(returnValue(true)); 2265 2266 2266 2267 oneOf(principalDao).getInternalIDFromHref(permissions.getPermission().get(2).getPrincipalHref()); 2267 2268 will(returnValue(4)); 2268 2269 2269 oneOf(annotationDao).getAccess(1, 4); 2270 will(returnValue(null)); 2271 2272 oneOf(annotationDao).updateAnnotationPrincipalAccess(1, 3, Access.READ); 2273 will(returnValue(1)); 2274 2275 oneOf(annotationDao).addAnnotationPrincipalAccess(1, 4, Access.READ); 2276 will(returnValue(1)); 2277 2278 } 2279 }); 2280 2281 assertEquals(2, dbDispatcher.updatePermissions(1, permissions)); 2270 oneOf(annotationDao).hasExplicitAccess(1, 4); 2271 will(returnValue(false)); 2272 2273 oneOf(annotationDao).updatePermission(1, 2, Access.WRITE); 2274 will(returnValue(1)); 2275 2276 oneOf(annotationDao).updatePermission(1, 3, Access.READ); 2277 will(returnValue(1)); 2278 2279 oneOf(annotationDao).addPermission(1, 4, Access.READ); 2280 will(returnValue(1)); 2281 2282 } 2283 }); 2284 2285 assertEquals(3, dbDispatcher.updatePermissions(1, permissions)); 2282 2286 2283 2287 } … … 2293 2297 { 2294 2298 ///// 2295 oneOf(annotationDao).updatePublicA ttribute(1, Access.NONE);2299 oneOf(annotationDao).updatePublicAccess(1, Access.NONE); 2296 2300 will(returnValue(1)); 2297 2301
Note: See TracChangeset
for help on using the changeset viewer.