コード例 #1
0
 @Test(expected = InternalServerErrorException.class)
 public void testAddResourceServerAlreadyExists() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
   } finally {
     resource.delete(NAME);
   }
 }
コード例 #2
0
 @Test
 public void testGetAllResourceServers() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     Collection<ResourceServerDTO> result = resource.getAll();
     assertEquals(1, result.size());
     resource.add(
         ResourceServerDataGenerator.generateResourceServerDTO("rs_another_resource_server"));
     result = resource.getAll();
     assertEquals(2, result.size());
   } finally {
     resource.delete(NAME);
     resource.delete("rs_another_resource_server");
   }
 }
コード例 #3
0
 @Test
 public void testGetResourceServer() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     ResourceServerDTO result = resource.get(NAME);
     assertResourceServer(result);
   } finally {
     resource.delete(NAME);
   }
 }
コード例 #4
0
 @Test
 public void testUpdateResourceServer() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     Set<String> groupFilter = new HashSet<String>(Arrays.asList("a", "b"));
     ResourceServerDTO rsToUpdate =
         ResourceServerDTO.builder().withName(NAME).withGroupFilter(groupFilter).build();
     ResourceServerDTO updatedRS = resource.update(NAME, rsToUpdate);
     assertEquals(groupFilter, updatedRS.getGroupFilter());
   } finally {
     resource.delete(NAME);
   }
 }
コード例 #5
0
 public void testDeleteResourceServer() throws Exception {
   resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
   resource.delete(NAME);
   Collection<ResourceServerDTO> result = resource.getAll();
   assertEquals(0, result.size());
 }