Changeset 5834


Ignore:
Timestamp:
11/17/14 10:45:37 (10 years ago)
Author:
Twan Goosen
Message:

merged changes from trunk

Location:
ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0

  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry

  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/pom.xml

    r5781 r5834  
    2222        <packaging>war</packaging>
    2323        <!-- Properties to configure ComponentRegistry override on commandline
    24                         with -D or change here -->
     24        with -D or change here -->
    2525        <serviceRootUrl>http://localhost:8080/${project.artifactId}</serviceRootUrl>
    2626        <!-- Will be inserted in context.xml -->
     
    133133            <exclusions>
    134134                <!-- Jersey has dependencies with different group ids therefore maven
    135                                                 cannot resolve the conflict and gives me both jars (two of stax and two of
    136                                                 jaxb-impl). Excluding them manually to overcome the problem -->
     135                cannot resolve the conflict and gives me both jars (two of stax and two of
     136                jaxb-impl). Excluding them manually to overcome the problem -->
    137137                <exclusion>
    138138                    <groupId>stax</groupId>
     
    146146            <version>${jersey.version}</version>
    147147            <scope>test</scope>
     148        </dependency>
     149        <dependency>
     150            <groupId>com.wordnik</groupId>
     151            <artifactId>swagger-jersey-jaxrs_2.10</artifactId>
     152            <version>1.3.0</version>
    148153        </dependency>
    149154        <dependency>
     
    539544
    540545    <!--
    541                 <reporting>
    542                                 <plugins>
    543                                                 <plugin>
    544                                                                 <groupId>org.codehaus.mojo</groupId>
    545                                                                 <artifactId>findbugs-maven-plugin</artifactId>
    546                                                         <version>2.5.4-SNAPSHOT</version>
    547                                                                 <configuration>
    548                                                                         <excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
    549                                                                         <threshold>Normal</threshold>
    550                                                                         <effort>Min</effort>
    551                                                                 </configuration>
    552                                                 </plugin>
    553                                 </plugins>
    554                 </reporting>
     546                <reporting>
     547                                <plugins>
     548                                                <plugin>
     549                                                                <groupId>org.codehaus.mojo</groupId>
     550                                                                <artifactId>findbugs-maven-plugin</artifactId>
     551                                                        <version>2.5.4-SNAPSHOT</version>
     552                                                                <configuration>
     553                                                                        <excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
     554                                                                        <threshold>Normal</threshold>
     555                                                                        <effort>Min</effort>
     556                                                                </configuration>
     557                                                </plugin>
     558                                </plugins>
     559                </reporting>
    555560    -->
    556561    <repositories>
     
    561566        </repository>
    562567        <!--
    563                 <repository>
    564                                 <id>sonatype</id>
    565                                 <url>https://oss.sonatype.org/content/groups/public</url>
    566                 </repository>
    567                 -->
     568        <repository>
     569                        <id>sonatype</id>
     570                        <url>https://oss.sonatype.org/content/groups/public</url>
     571        </repository>
     572        -->
    568573    </repositories>
    569574</project>
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/java

  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java

    r5823 r5834  
    3131import com.sun.jersey.api.core.InjectParam;
    3232import com.sun.jersey.multipart.FormDataParam;
     33import com.wordnik.swagger.annotations.ApiOperation;
     34import com.wordnik.swagger.annotations.ApiResponse;
     35import com.wordnik.swagger.annotations.ApiResponses;
    3336
    3437import java.io.IOException;
     
    8992public class ComponentRegistryRestService implements
    9093        IComponentRegistryRestService {
    91    
     94
    9295    private final static Logger LOG = LoggerFactory
    9396            .getLogger(ComponentRegistryRestService.class);
     
    108111    @Autowired
    109112    private GroupService groupService;
    110    
     113
    111114    private ComponentRegistry getBaseRegistry() throws AuthenticationRequiredException {
    112115        Principal userPrincipal = security.getUserPrincipal();
     
    118121        }
    119122    }
    120    
     123
    121124    private ComponentRegistry getRegistry(RegistrySpace space, Number groupId) {
    122125        Principal userPrincipal = security.getUserPrincipal();
     
    145148        return principal;
    146149    }
    147    
     150
    148151    private UserCredentials getUserCredentials(Principal userPrincipal) {
    149152        UserCredentials userCredentials = null;
     
    153156        return userCredentials;
    154157    }
    155    
     158
    156159    private ComponentRegistry initialiseRegistry(String space, String groupId) throws AuthenticationRequiredException {
    157160        //checking credentials
     
    166169            groupIdNumber = Integer.parseInt(groupId);
    167170        }
    168        
     171
    169172        return this.getRegistry(regSpace, groupIdNumber);
    170173    }
    171    
     174
    172175    private boolean checkRegistrySpaceString(String registrySpace) {
    173176        return (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) || registrySpace.equalsIgnoreCase(REGISTRY_SPACE_PRIVATE) || registrySpace.equalsIgnoreCase(REGISTRY_SPACE_PUBLISHED));
    174177    }
    175    
     178
    176179    @Override
    177180    @GET
     
    185188            throws ComponentRegistryException, IOException {
    186189        long start = System.currentTimeMillis();
    187        
     190
    188191        // deprecated parameter, processed here for backwards compatibility
    189192        if (!Strings.isNullOrEmpty(userSpace)) {
     
    193196            }
    194197        }
    195        
     198
    196199        if (!checkRegistrySpaceString(registrySpace)) {
    197200            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
    198201            return new ArrayList<ComponentDescription>();
    199202        }
    200        
     203
    201204        try {
    202205            ComponentRegistry cr = this.initialiseRegistry(registrySpace, groupId);
     
    205208                    "Releasing {} registered components into the world ({} millisecs)",
    206209                    result.size(), (System.currentTimeMillis() - start));
    207            
     210
    208211            return result;
    209212        } catch (AuthenticationRequiredException e) {
    210213            response.sendError(Status.UNAUTHORIZED.getStatusCode(), e.toString());
    211214            return new ArrayList<ComponentDescription>();
    212            
     215
    213216        } catch (UserUnauthorizedException e) {
    214217            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    215218            return new ArrayList<ComponentDescription>();
    216            
     219
    217220        } catch (ItemNotFoundException e) {
    218221            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
    219222            return new ArrayList<ComponentDescription>();
    220223        }
    221        
    222     }
    223    
     224
     225    }
     226
    224227    @Override
    225228    @GET
     
    234237    )
    235238            throws ComponentRegistryException, IOException {
    236        
     239
    237240        long start = System.currentTimeMillis();
    238241
     
    244247            }
    245248        }
    246        
     249
    247250        if (!checkRegistrySpaceString(registrySpace)) {
    248251            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
     
    255258                    "Releasing {} registered components into the world ({} millisecs)",
    256259                    result.size(), (System.currentTimeMillis() - start));
    257            
     260
    258261            return result;
    259262        } catch (AuthenticationRequiredException e) {
    260263            response.sendError(Status.UNAUTHORIZED.getStatusCode(), e.toString());
    261264            return new ArrayList<ProfileDescription>();
    262            
     265
    263266        } catch (UserUnauthorizedException e) {
    264267            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    265268            return new ArrayList<ProfileDescription>();
    266            
     269
    267270        } catch (ItemNotFoundException e) {
    268271            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
     
    270273        }
    271274    }
    272    
     275
    273276    @Override
    274277    @GET
     
    292295        }
    293296    }
    294    
     297
    295298    @Override
    296299    @GET
     
    298301    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    299302        MediaType.APPLICATION_JSON})
     303    @ApiOperation(value = "Get the component specification XML a single profile", response = CMDComponentSpec.class)
     304    @ApiResponses(value = {
     305        @ApiResponse(code = 403, message = "Profile does not exist")
     306    })
    300307    public Response getRegisteredProfile(
    301308            @PathParam("profileId") String profileId) throws IOException {
     
    314321        }
    315322    }
    316    
     323
    317324    @Override
    318325    @GET
     
    321328    public Response getRegisteredComponentRawType(
    322329            @PathParam("componentId") final String componentId, @PathParam("rawType") String rawType) throws ComponentRegistryException {
    323        
     330
    324331        LOG.debug("Component with id: {} and rawType: {} is requested.", componentId, rawType);
    325332        try {
     
    356363                                            .build());
    357364                                }
    358                                
     365
    359366                            } catch (UserUnauthorizedException e2) {
    360367                                LOG.error(e2.toString());
     
    393400                                LOG.error(e2.toString());
    394401                            }
    395                            
     402
    396403                        }
    397404                    };
     
    400407                    return Response.status(Status.NOT_FOUND).entity("Usupported raw type " + rawType).build();
    401408                }
    402                
     409
    403410            } catch (UserUnauthorizedException e2) {
    404411                return Response.status(Status.FORBIDDEN).build();
     
    410417        }
    411418    }
    412    
     419
    413420    @Override
    414421    @GET
     
    418425    public List<BaseDescription> getComponentUsage(
    419426            @PathParam("componentId") String componentId) throws ComponentRegistryException, IOException {
    420        
     427
    421428        final long start = System.currentTimeMillis();
    422429        try {
     
    424431            List<ComponentDescription> components = registry.getUsageInComponents(componentId);
    425432            List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId);
    426            
     433
    427434            LOG.debug(
    428435                    "Found {} components and {} profiles that use component {} ({} millisecs)",
    429436                    components.size(), profiles.size(), componentId,
    430437                    (System.currentTimeMillis() - start));
    431            
     438
    432439            List<BaseDescription> usages = new ArrayList<BaseDescription>(components.size() + profiles.size());
    433440            usages.addAll(components);
    434441            usages.addAll(profiles);
    435            
     442
    436443            return usages;
    437444        } catch (ComponentRegistryException e) {
     
    444451        }
    445452    }
    446    
     453
    447454    @Override
    448455    @GET
     
    474481        }
    475482    }
    476    
     483
    477484    @Override
    478485    @GET
     
    504511        }
    505512    }
    506    
     513
    507514    @Override
    508515    @GET
     
    514521            @PathParam("commentId") String commentId)
    515522            throws IOException {
    516        
     523
    517524        LOG.debug("Comments of profile with id {} are requested.", commentId);
    518525        try {
    519            
     526
    520527            return this.getBaseRegistry().getSpecifiedCommentInProfile(profileId, commentId);
    521528        } catch (ComponentRegistryException e) {
     
    533540        }
    534541    }
    535    
     542
    536543    @Override
    537544    @GET
     
    584591        }
    585592    }
    586    
     593
    587594    @Override
    588595    @POST
     
    598605        }
    599606    }
    600    
     607
    601608    @Override
    602609    @POST
     
    625632            @FormDataParam(GROUP_FORM_FIELD) String group,
    626633            @FormDataParam(DOMAIN_FORM_FIELD) String domainName) {
    627        
     634
    628635        try {
    629636            Principal principal = checkAndGetUserPrincipal();
     
    645652                        .build();
    646653            }
    647            
     654
    648655        } catch (AuthenticationRequiredException e) {
    649656            return Response.serverError().status(Status.UNAUTHORIZED)
     
    661668        }
    662669    }
    663    
     670
    664671    @Override
    665672    @POST
     
    680687                    return Response.status(Status.CONFLICT).entity("Cannot update already published profile.")
    681688                            .build();
    682                    
     689
    683690                }
    684691                Number groupId;
     
    692699                    space = RegistrySpace.GROUP;
    693700                }
    694                
     701
    695702                updateDescription(desc, name, description, domainName, group);
    696703                ComponentRegistry cr = this.getRegistry(space, groupId);
     
    709716            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    710717                    .build();
    711            
     718
    712719        } catch (UserUnauthorizedException ex) {
    713720            return Response.status(Status.FORBIDDEN).entity(ex.getMessage())
    714721                    .build();
    715            
     722
    716723        } catch (ItemNotFoundException ex2) {
    717724            return Response.status(Status.NOT_FOUND).entity(ex2.getMessage())
     
    721728                    .build();
    722729        }
    723        
     730
    724731    }
    725732
     
    760767            @FormDataParam(GROUP_FORM_FIELD) String group,
    761768            @FormDataParam(DOMAIN_FORM_FIELD) String domainName) {
    762        
     769
    763770        try {
    764771            Principal principal = checkAndGetUserPrincipal();
     
    801808        }
    802809    }
    803    
     810
    804811    @Override
    805812    @POST
     
    831838                    space = RegistrySpace.GROUP;
    832839                }
    833                
     840
    834841                this.updateDescription(desc, name, description, domainName, group);
    835842                ComponentRegistry cr = this.getRegistry(space, groupId);
     
    858865                    .build();
    859866        }
    860        
    861     }
    862    
     867
     868    }
     869
    863870    private void updateDescription(BaseDescription desc, String name,
    864871            String description, String domainName, String group) {
     
    869876        desc.setRegistrationDate(new Date());
    870877    }
    871    
     878
    872879    @Override
    873880    @DELETE
     
    909916                    .build();
    910917        }
    911        
     918
    912919        LOG.info("Component with id: {} deleted.", componentId);
    913920        return Response.ok("Component with id" + componentId + " deleted.").build();
    914921    }
    915    
     922
    916923    @Override
    917924    @DELETE
    918925    @Path("/profiles/{profileId}")
     926    @ApiOperation(value = "Deletes a profile from the registry")
     927    @ApiResponses(value = {
     928        @ApiResponse(code = 401, message = "User is not logged authenticated"),
     929        @ApiResponse(code = 403, message = "Profile is not owned by current user and user is no administrator or profile is published and has been consolidated into the registry"),
     930        @ApiResponse(code = 404, message = "Profile does not exist")
     931    })
    919932    public Response deleteRegisteredProfile(
    920933            @PathParam("profileId") String profileId) {
     
    950963                    .build();
    951964        }
    952        
     965
    953966        LOG.info("Profile with id: {} deleted.", profileId);
    954967        return Response.ok().build();
    955968    }
    956    
     969
    957970    @Override
    958971    @DELETE
    959972    @Path("/profiles/{profileId}/comments/{commentId}")
     973    @ApiOperation(value = "Deletes a comment from a profile")
     974    @ApiResponses(value = {
     975        @ApiResponse(code = 401, message = "User is not authenticated"),
     976        @ApiResponse(code = 403, message = "Comment is not owned by current user and user is no administrator"),
     977        @ApiResponse(code = 404, message = "Comment does not exist")
     978    })
    960979    public Response deleteCommentFromProfile(
    961980            @PathParam("profileId") String profileId,
     
    980999                        .entity("" + e1.getMessage()).build();
    9811000            }
    982            
     1001
    9831002        } catch (DeleteFailedException e) {
    9841003            LOG.info("Comment with id: {} deletion failed: {}", commentId,
     
    10051024                    .build();
    10061025        }
    1007        
     1026
    10081027        LOG.info("Comment with id: {} deleted.", commentId);
    10091028        return Response.ok("Comment with id " + commentId + " deleted.").build();
    10101029    }
    1011    
     1030
    10121031    @Override
    10131032    @DELETE
    10141033    @Path("/components/{componentId}/comments/{commentId}")
     1034    @ApiOperation(value = "Deletes a comment from a component")
     1035    @ApiResponses(value = {
     1036        @ApiResponse(code = 401, message = "User is not authenticated"),
     1037        @ApiResponse(code = 403, message = "Comment is not owned by current user and user is no administrator"),
     1038        @ApiResponse(code = 404, message = "Comment does not exist")
     1039    })
    10151040    public Response deleteCommentFromComponent(
    10161041            @PathParam("componentId") String componentId,
     
    10571082                    .build();
    10581083        }
    1059        
     1084
    10601085        LOG.info("Comment with id: {} deleted.", commentId);
    10611086        return Response.ok("Comment with id " + commentId + " deleted.").build();
    10621087    }
    1063    
     1088
    10641089    @Override
    10651090    @GET
     
    10691094            @PathParam("profileId") final String profileId,
    10701095            @PathParam("rawType") String rawType) throws ComponentRegistryException, IllegalArgumentException {
    1071        
     1096
    10721097        LOG.debug("Profile with id {} and rawType {} is requested.", profileId,
    10731098                rawType);
    10741099        try {
    10751100            final ComponentRegistry registry = this.getBaseRegistry();
    1076            
     1101
    10771102            ProfileDescription desc = registry.getProfileDescriptionAccessControlled(profileId);
    10781103            if (desc == null) {
    10791104                return Response.status(Status.NOT_FOUND).build();
    10801105            }
    1081            
     1106
    10821107            StreamingOutput result = null;
    10831108            String fileName = desc.getName() + "." + rawType;
     
    11311156                    .build();
    11321157        }
    1133        
    1134     }
    1135    
     1158
     1159    }
     1160
    11361161    private Response createDownloadResponse(StreamingOutput result,
    11371162            String fileName) {
     
    11441169                .entity(result).build();
    11451170        return response;
    1146        
    1147     }
    1148    
     1171
     1172    }
     1173
    11491174    @Override
    11501175    @POST
     
    11871212        }
    11881213    }
    1189    
     1214
    11901215    @Override
    11911216    @POST
     
    12281253        }
    12291254    }
    1230    
     1255
    12311256    @Override
    12321257    @POST
     
    12411266            ComponentRegistry registry = this.getBaseRegistry();
    12421267            ComponentDescription description = registry.getComponentDescriptionAccessControlled(componentId);
    1243            
     1268
    12441269            LOG.debug("Trying to register comment to {}", componentId);
    1245            
     1270
    12461271            return this.registerComment(input, description, registry);
    12471272        } catch (AuthenticationRequiredException e) {
     
    12731298            ProfileDescription description = registry
    12741299                    .getProfileDescriptionAccessControlled(profileId);
    1275            
     1300
    12761301            LOG.debug("Trying to register comment to {}", profileId);
    1277            
     1302
    12781303            return this.registerComment(input, description, registry);
    12791304        } catch (AuthenticationRequiredException e) {
     
    12891314        }
    12901315    }
    1291    
     1316
    12921317    @Override
    12931318    @GET
     
    13161341                                stillActive)).build();
    13171342    }
    1318    
     1343
    13191344    private Response register(InputStream input, BaseDescription desc, RegisterAction action, ComponentRegistry registry) throws UserUnauthorizedException, AuthenticationRequiredException {
    13201345        try {
    1321            
     1346
    13221347            DescriptionValidator descriptionValidator = new DescriptionValidator(
    13231348                    desc);
     
    13281353            this.validate(response, descriptionValidator, validator);
    13291354            if (response.getErrors().isEmpty()) {
    1330                
     1355
    13311356                CMDComponentSpec spec = validator.getCMDComponentSpec();
    13321357
     
    13341359                // recursion over all the components
    13351360                setFileNamesFromListToNull(Collections.singletonList(spec.getCMDComponent()));
    1336                
     1361
    13371362                try {
    13381363                    checkForRecursion(validator, registry, desc);
     
    14041429        }
    14051430    }
    1406    
     1431
    14071432    private Response registerComment(InputStream input, BaseDescription description, ComponentRegistry registry) throws UserUnauthorizedException, AuthenticationRequiredException {
    14081433        try {
    14091434            CommentValidator validator = new CommentValidator(input, description, marshaller);
    14101435            CommentResponse responseLocal = new CommentResponse();
    1411            
     1436
    14121437            responseLocal.setIsPrivate(!description.isPublic());
    14131438            this.validateComment(responseLocal, validator);
     
    14691494        }
    14701495    }
    1471    
     1496
    14721497    private ComponentDescription createNewComponentDescription() {
    14731498        ComponentDescription desc = ComponentDescription.createNewDescription();
     
    14751500        return desc;
    14761501    }
    1477    
     1502
    14781503    private ProfileDescription createNewProfileDescription() {
    14791504        ProfileDescription desc = ProfileDescription.createNewDescription();
     
    14811506        return desc;
    14821507    }
    1483    
     1508
    14841509    private String createXlink(String id) {
    14851510        URI uri = uriInfo.getRequestUriBuilder().path(id).build();
     
    15001525        return servletContext.getInitParameter(APPLICATION_BASE_URL_PARAM);
    15011526    }
    1502    
     1527
    15031528    private void validate(RegisterResponse response, Validator... validators) throws UserUnauthorizedException {
    15041529        for (Validator validator : validators) {
     
    15101535        }
    15111536    }
    1512    
     1537
    15131538    private void validateComment(CommentResponse response,
    15141539            Validator... validators) throws UserUnauthorizedException {
     
    15391564    public void setFileNamesFromListToNull(
    15401565            List<CMDComponentType> listofcomponents) {
    1541        
     1566
    15421567        for (CMDComponentType currentcomponent : listofcomponents) {
    15431568            setFileNamesToNullCurrent(currentcomponent);
    15441569        }
    1545        
     1570
    15461571    }
    15471572
     
    15551580        setFileNamesFromListToNull(currentcomponent.getCMDComponent());
    15561581    }
    1557    
     1582
    15581583    private String helpToMakeTitleForRssDescriptions(String registrySpace, String groupId, String resource, ComponentRegistry cr) throws ItemNotFoundException {
    15591584        if (registrySpace == null || (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) && groupId == null)
     
    15671592            return "Private " + resource;
    15681593        }
    1569        
     1594
    15701595        if (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) && groupId != null) {
    15711596            return resource + " of group " + groupId + " '" + cr.getGroupName(Integer.parseInt(groupId)) + "'";
    15721597        }
    1573        
     1598
    15741599        return "Undefined registry space or uindefined type of resource";
    15751600    }
     
    16101635            return new Rss();
    16111636        }
    1612        
     1637
    16131638        final RssCreatorDescriptions instance = new RssCreatorDescriptions(getApplicationBaseURI(), "components",
    16141639                Integer.parseInt(limit), components,
     
    16511676            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    16521677            return new Rss();
    1653            
     1678
    16541679        } catch (ItemNotFoundException e) {
    16551680            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
     
    16641689        return rss;
    16651690    }
    1666    
     1691
    16671692    private String helpToMakeTitleForRssComments(String itemId, String resource) {
    16681693        if (itemId == null || resource == null) {
     
    16951720            ParseException {
    16961721        try {
    1697            
     1722
    16981723            ComponentRegistry cr = this.getBaseRegistry();
    1699            
     1724
    17001725            final List<Comment> comments = cr.getCommentsInProfile(profileId);
    17011726            final ProfileDescription pd = cr.getProfileDescriptionAccessControlled(profileId);
    17021727            final String profileName = pd.getName();
    1703            
     1728
    17041729            String title = this.helpToMakeTitleForRssComments(profileId, "profile");
    17051730            final RssCreatorComments instance = new RssCreatorComments(
     
    17691794            return new Rss();
    17701795        }
    1771        
    1772     }
    1773    
     1796
     1797    }
     1798
    17741799    @Override
    17751800    @GET
     
    17771802    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    17781803        MediaType.APPLICATION_JSON})
     1804    @ApiOperation(
     1805            value = "A listing of values that are allowed as element or attribute type by the CMDI schema",
     1806            response = AllowedAttributetypesXML.class)
    17791807    public AllowedAttributetypesXML getAllowedAttributeTypes()
    17801808            throws ComponentRegistryException, IOException, JAXBException,
     
    17821810        return (new AllowedAttributetypesXML());
    17831811    }
    1784    
     1812
    17851813    @Override
    17861814    @GET
     
    17961824        return groups;
    17971825    }
    1798    
     1826
    17991827    @Override
    18001828    @GET
     
    18051833        return groupService.getGroupsTheItemIsAMemberOf(itemId);
    18061834    }
    1807    
     1835
    18081836    @Override
    18091837    @POST
     
    18211849        }
    18221850    }
    1823    
     1851
    18241852    @Override
    18251853    @GET
     
    18271855    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    18281856        MediaType.APPLICATION_JSON})
     1857    @ApiOperation(value = "The description (metadata) of a single component or profile item")
     1858    @ApiResponses(value = {
     1859        @ApiResponse(code = 401, message = "User is not authenticated and authentication is required"),
     1860        @ApiResponse(code = 403, message = "Item is not accessible to the current user"),
     1861        @ApiResponse(code = 404, message = "Item does not exist")
     1862    })
    18291863    public BaseDescription getBaseDescription(@PathParam("itemId") String itemId) throws ComponentRegistryException, IOException {
    18301864        LOG.debug("Item with id: {} is requested.", itemId);
     
    18421876            response.sendError(Status.BAD_REQUEST.getStatusCode());
    18431877            return new BaseDescription();
    1844            
     1878
    18451879        } catch (UserUnauthorizedException ex2) {
    18461880            response.sendError(Status.FORBIDDEN.getStatusCode(), ex2.getMessage());
     
    18541888        }
    18551889    }
    1856 
    1857     // Group Service (added by Olha)
    1858     @Override
    1859     @POST
    1860     @Path("/groups/create")
    1861     @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    1862         MediaType.APPLICATION_JSON})
    1863     public Response createNewGroup(@QueryParam("groupName") String groupName) throws IOException {
    1864        
    1865         try {
    1866             Principal principal = this.checkAndGetUserPrincipal();
    1867             Number id = groupService.createNewGroup(groupName, principal.getName());
    1868             return Response.ok("Group with the name " + groupName + " is created and given an id " + id).build();
    1869         } catch (AuthenticationRequiredException e) {
    1870             return Response.status(Status.UNAUTHORIZED).build();
    1871         }
    1872     }
    1873    
    1874     @Override
    1875     @GET
    1876     @Path("/groups/principal")
    1877     @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    1878         MediaType.APPLICATION_JSON})
    1879     public List<Group> getGroupsOwnedByUser(@QueryParam("principalName") String pricipalName) throws IOException {
    1880        
    1881         try {
    1882             Principal principal = this.checkAndGetUserPrincipal();
    1883             return groupService.getGroupsOwnedByUser(principal.getName());
    1884         } catch (AuthenticationRequiredException e) {
    1885             response.sendError(Status.UNAUTHORIZED.getStatusCode());
    1886             return new ArrayList<Group>();
    1887         }
    1888     }
    1889    
    1890     @Override
    1891     @GET
    1892     @Path("/groups/names")
    1893     public Response listGroupNames() throws IOException {
    1894        
    1895         try {
    1896             Principal principal = this.checkAndGetUserPrincipal();
    1897             List<String> result = groupService.listGroupNames();
    1898             //final GenericEntity<List<String>> entity  = new GenericEntity<List<String>>(result){};
    1899             //return Response.status(Status.OK).entity(entity).build();
    1900             StringsWrapper ids = new StringsWrapper();
    1901             ids.setStrings(result);
    1902             return Response.status(Status.OK).entity(ids).build();
    1903         } catch (AuthenticationRequiredException e) {
    1904             return Response.status(Status.UNAUTHORIZED).build();
    1905         }
    1906     }
    1907    
    1908     @Override
    1909     @GET
    1910     @Path("/groups/ownership")
    1911     public Response isOwner(@QueryParam("groupName") String groupName) throws IOException {
    1912        
    1913         try {
    1914             Principal principal = this.checkAndGetUserPrincipal();
    1915             Boolean isOwner = groupService.isUserOwnerOfGroup(groupName, principal.getName());
    1916             return Response.ok(isOwner.toString()).build();
    1917         } catch (AuthenticationRequiredException e) {
    1918             return Response.serverError().status(Status.UNAUTHORIZED).build();
    1919         }
    1920     }
    1921    
    1922     @Override
    1923     @POST
    1924     @Path("/groups/makemember")
    1925     @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    1926         MediaType.APPLICATION_JSON})
    1927     public Response makeGroupMember(@QueryParam("groupName") String groupName, @QueryParam("principalName") String principalName) throws IOException {
    1928         try {
    1929             ComponentRegistry registry = this.getBaseRegistry();
    1930             Number id = registry.makeGroupMember(principalName, groupName);
    1931             return Response.ok(id.toString()).build();
    1932         } catch (UserUnauthorizedException e) {
    1933             return Response.status(Status.FORBIDDEN).entity(e.getMessage()).build();
    1934         } catch (ItemNotFoundException e) {
    1935             return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
    1936            
    1937         } catch (AuthenticationRequiredException e) {
    1938             return Response.status(Status.UNAUTHORIZED).build();
    1939         }
    1940     }
    1941 
    1942 //    @Override
    1943 //    @DELETE
    1944 //    @Path("/groups/removemember")
    1945 //    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    1946 //        MediaType.APPLICATION_JSON})
    1947 //    public Response removeGroupMember(@QueryParam("groupName") String groupName, @QueryParam("principalName") String principalName) throws IOException {
    1948 //        try {
    1949 //            ComponentRegistry registry = this.getBaseRegistry();
    1950 //            Number id = registry.removeGroupMember(principalName, groupName);
    1951 //            return Response.ok(id.toString()).build();
    1952 //        } catch (UserUnauthorizedException e) {
    1953 //            return Response.status(Status.FORBIDDEN).entity(e.getMessage()).build();
    1954 //        } catch (ItemNotFoundException e) {
    1955 //            return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
    1956 //       
    1957 //        } catch (AuthenticationRequiredException e) {
    1958 //            return Response.status(Status.UNAUTHORIZED).build();
    1959 //        }
    1960 //    }
    1961     @Override
    1962     @GET
    1963     @Path("/groups/profiles")
    1964     public Response listProfiles(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1965        
    1966         try {
    1967             Principal principal = this.checkAndGetUserPrincipal();
    1968             List<String> result = groupService.getProfileIdsInGroup(Long.parseLong(groupId));
    1969             StringsWrapper ids = new StringsWrapper();
    1970             ids.setStrings(result);
    1971             return Response.status(Status.OK).entity(ids).build();
    1972         } catch (AuthenticationRequiredException e) {
    1973             return Response.status(Status.UNAUTHORIZED).build();
    1974         }
    1975     }
    1976    
    1977     @Override
    1978     @GET
    1979     @Path("/groups/components")
    1980     public Response listComponents(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1981        
    1982         try {
    1983             Principal principal = this.checkAndGetUserPrincipal();
    1984             List<String> result = groupService.getComponentIdsInGroup(Long.parseLong(groupId));
    1985             StringsWrapper ids = new StringsWrapper();
    1986             ids.setStrings(result);
    1987             return Response.status(Status.OK).entity(ids).build();
    1988         } catch (AuthenticationRequiredException e) {
    1989             response.sendError(Status.UNAUTHORIZED.getStatusCode());
    1990             return Response.status(Status.UNAUTHORIZED).build();
    1991         }
    1992     }
    1993    
    1994     @Override
    1995     @GET
    1996     @Path("/groups/nameById")
    1997     public Response getGroupNameById(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1998        
    1999         try {
    2000             Principal principal = this.checkAndGetUserPrincipal();
    2001             String name = groupService.getGroupNameById(Long.parseLong(groupId));
    2002             return Response.ok(name).build();
    2003         } catch (AuthenticationRequiredException e) {
    2004             return Response.status(Status.UNAUTHORIZED).build();
    2005         } catch (ItemNotFoundException e) {
    2006             return Response.status(Status.NOT_FOUND).build();
    2007         }
    2008     }
    2009    
    2010     @Override
    2011     @GET
    2012     @Path("/groups/idByName")
    2013     public Response getGroupIdByName(@QueryParam("groupName") String groupName) throws IOException {
    2014        
    2015         try {
    2016             Principal principal = this.checkAndGetUserPrincipal();
    2017             Number id = groupService.getGroupIdByName(groupName);
    2018             return Response.ok(id.toString()).build();
    2019         } catch (AuthenticationRequiredException e) {
    2020             return Response.status(Status.UNAUTHORIZED).build();
    2021         } catch (ItemNotFoundException e) {
    2022             return Response.status(Status.NOT_FOUND).build();
    2023         }
    2024     }
    2025    
    2026     @XmlRootElement(name = "Identifiers")
    2027     public static class StringsWrapper {
    2028        
    2029         @XmlElement(name = "item")
    2030         List<String> strings = new ArrayList<String>();
    2031        
    2032         StringsWrapper() {
    2033         }
    2034        
    2035         public void setStrings(List<String> strings) {
    2036             this.strings = strings;
    2037         }
    2038     }
    20391890}
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java

    r5823 r5834  
    202202    Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;
    203203
    204     // (added by Olha)
    205     Response createNewGroup(String groupName) throws IOException;
    206 
    207     List<Group> getGroupsOwnedByUser(String pricipalName) throws IOException;
    208 
    209     Response listGroupNames() throws IOException;
    210 
    211     Response isOwner(String groupName) throws IOException;
    212 
    213     Response makeGroupMember(String groupName, String principalName) throws IOException;
    214 
    215     //Response removeGroupMember(String groupName, String principalName) throws IOException;
    216     Response listProfiles(String groupId) throws IOException;
    217 
    218     Response listComponents(String groupId) throws IOException;
    219 
    220     Response getGroupNameById(String groupId) throws IOException;
    221 
    222     Response getGroupIdByName(String groupName) throws IOException;
    223204}
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/webapp/WEB-INF/web-shib.xml

    r4109 r5834  
    22
    33<!--
    4         Configuration file for ComponentRegistry in shibbolized context, which
    5         any production environment should be.
     4        Configuration file for ComponentRegistry in shibbolized context, which
     5        any production environment should be.
    66-->
    77
    88<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    9   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     9         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    1010    <display-name>ComponentRegistry</display-name>
    1111    <description>Clarin Metadata Component Registry</description>
     
    1717    </context-param>
    1818    <context-param>
    19                 <param-name>contextConfigLocation</param-name>
    20                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    21                 </param-value>
    22         </context-param>
     19        <param-name>contextConfigLocation</param-name>
     20        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     21        </param-value>
     22    </context-param>
    2323
    2424    <listener>
     
    3636        </init-param>
    3737    </filter>
    38         <filter>
    39                 <filter-name>NoCachingFilter</filter-name>
    40                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    41         </filter>
    42         <filter-mapping>
    43                 <filter-name>NoCachingFilter</filter-name>
    44                 <url-pattern>/rest/registry/*</url-pattern>
    45         </filter-mapping>
     38    <filter>
     39        <filter-name>NoCachingFilter</filter-name>
     40        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     41    </filter>
     42    <filter-mapping>
     43        <filter-name>NoCachingFilter</filter-name>
     44        <url-pattern>/rest/registry/*</url-pattern>
     45    </filter-mapping>
    4646   
    4747   
     
    5151    </filter-mapping>
    5252 
    53 <!-- Make sure this one is declared before the wicket filter, the order matters. Shibboleth should trigger the login, before continuing with the wicket filter.-->
     53    <!-- Make sure this one is declared before the wicket filter, the order matters. Shibboleth should trigger the login, before continuing with the wicket filter.-->
    5454    <filter>
    5555        <filter-name>AAIFilter</filter-name>
     
    7474        <init-param>
    7575            <param-name>configuration</param-name>
    76 <!--      <param-value>development</param-value>-->
     76            <!--      <param-value>development</param-value>-->
    7777            <param-value>deployment</param-value>
    78       <!-- you can override with -Dwicket.configuration=development -->
     78            <!-- you can override with -Dwicket.configuration=development -->
    7979        </init-param>
    8080    </filter>
     
    8383        <url-pattern>/admin/*</url-pattern>
    8484    </filter-mapping>
    85         <servlet>
    86                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    87                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    88                 <init-param> <param-name>com.sun.jersey.config.property.classnames</param-name>
    89                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
    90                 </init-param>
    91                 <load-on-startup>1</load-on-startup>
    92         </servlet>
     85    <servlet>
     86        <servlet-name>ComponentRegistry Web Application</servlet-name>
     87        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     88        <init-param>
     89            <param-name>com.sun.jersey.config.property.classnames</param-name>
     90            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     91        </init-param>
     92        <init-param>
     93            <param-name>com.sun.jersey.config.property.packages</param-name>
     94            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     95        </init-param>
     96        <load-on-startup>1</load-on-startup>
     97    </servlet>
    9398    <servlet-mapping>
    9499        <servlet-name>ComponentRegistry Web Application</servlet-name>
     
    105110        <url-pattern>/isocat/*</url-pattern>
    106111    </servlet-mapping>
     112    <servlet>
     113        <servlet-name>JerseyJaxrsConfig</servlet-name>
     114        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     115        <init-param>
     116            <param-name>api.version</param-name>
     117            <param-value>1.0.0</param-value>
     118        </init-param>
     119        <init-param>
     120            <param-name>swagger.api.basepath</param-name>
     121            <param-value>https://catalog.clarin.eu/ds/ComponentRegistry/rest</param-value>
     122        </init-param>
     123        <load-on-startup>2</load-on-startup>
     124    </servlet>
    107125
    108126</web-app>
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/webapp/WEB-INF/web-test.xml

    r4109 r5834  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!-- Configuration file for ComponentRegistry in NON-SHIBBOLIZED context,
    3         i.e. development or testing environments. -->
     3i.e. development or testing environments. -->
    44
    55<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8         <display-name>ComponentRegistry</display-name>
    9         <description>Clarin Metadata Component Registry</description>
    10         <listener>
    11                 <listener-class>org.springframework.web.context.ContextLoaderListener
    12                 </listener-class>
    13         </listener>
     6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     8    <display-name>ComponentRegistry</display-name>
     9    <description>Clarin Metadata Component Registry</description>
     10    <listener>
     11        <listener-class>org.springframework.web.context.ContextLoaderListener
     12        </listener-class>
     13    </listener>
    1414
    15         <context-param>
    16                 <param-name>contextConfigLocation</param-name>
    17                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    18                 </param-value>
    19         </context-param>
     15    <context-param>
     16        <param-name>contextConfigLocation</param-name>
     17        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     18        </param-value>
     19    </context-param>
    2020
    21         <filter>
    22                 <filter-name>characterEncodingFilter</filter-name>
    23                 <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
    24                 </filter-class>
    25                 <init-param>
    26                         <param-name>encoding</param-name>
    27                         <param-value>UTF-8</param-value>
    28                 </init-param>
    29         </filter>
    30         <filter-mapping>
    31                 <filter-name>characterEncodingFilter</filter-name>
    32                 <url-pattern>/*</url-pattern>
    33         </filter-mapping>
    34         <filter>
    35                 <filter-name>NoCachingFilter</filter-name>
    36                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    37         </filter>
    38         <filter-mapping>
    39                 <filter-name>NoCachingFilter</filter-name>
    40                 <url-pattern>/rest/registry/*</url-pattern>
    41         </filter-mapping>
    42         <filter>
    43                 <filter-name>wicket.componentregistry</filter-name>
    44                 <filter-class>org.apache.wicket.protocol.http.WicketFilter
    45                 </filter-class>
    46                 <init-param>
    47                         <param-name>applicationClassName</param-name>
    48                         <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
    49                         </param-value>
    50                 </init-param>
    51                 <init-param>
    52                         <param-name>configuration</param-name>
    53                         <!-- <param-value>development</param-value> -->
    54                         <param-value>deployment</param-value>
    55                         <!-- you can override with -Dwicket.configuration=development -->
    56                 </init-param>
    57         </filter>
    58         <filter-mapping>
    59                 <filter-name>wicket.componentregistry</filter-name>
    60                 <url-pattern>/admin/*</url-pattern>
    61         </filter-mapping>
    62         <servlet>
    63                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    64                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet
    65                 </servlet-class>
    66                 <init-param>
    67                         <param-name>com.sun.jersey.config.property.resourceConfigClass
    68                         </param-name>
    69                         <param-value>com.sun.jersey.api.core.ClassNamesResourceConfig
    70                         </param-value>
    71                 </init-param>
    72                 <init-param>
    73                         <param-name>com.sun.jersey.config.property.classnames</param-name>
    74                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider;clarin.cmdi.componentregistry.rest.ComponentRegistryRestService
    75                         </param-value>
    76                 </init-param>
    77                 <!-- <init-param> -->
    78                 <!-- <param-name>com.sun.jersey.config.property.packages</param-name> -->
    79                 <!-- <param-value>clarin.cmdi.componentregistry.rest</param-value> -->
    80                 <!-- </init-param> -->
    81                 <load-on-startup>1</load-on-startup>
    82         </servlet>
    83         <servlet-mapping>
    84                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    85                 <url-pattern>/rest/*</url-pattern>
    86         </servlet-mapping>
    87         <servlet>
    88                 <servlet-name>Isocat Servlet</servlet-name>
    89                 <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
    90                 </servlet-class>
    91                 <load-on-startup>1</load-on-startup>
    92         </servlet>
    93         <servlet-mapping>
    94                 <servlet-name>Isocat Servlet</servlet-name>
    95                 <url-pattern>/isocat/*</url-pattern>
    96         </servlet-mapping>
    97         <security-constraint>
    98                 <display-name>ComponentRegistry web service</display-name>
    99                 <web-resource-collection>
    100                         <web-resource-name>ComponentRegistry edit</web-resource-name>
    101                         <description />
    102                         <url-pattern>/rest/*</url-pattern>
    103                         <http-method>DELETE</http-method>
    104                         <http-method>PUT</http-method>
    105                         <http-method>POST</http-method>
    106                 </web-resource-collection>
    107                 <auth-constraint>
    108                         <role-name>tomcat</role-name>
    109                 </auth-constraint>
    110         </security-constraint>
    111         <security-constraint>
    112                 <display-name>ComponentRegistry SWF GET</display-name>
    113                 <web-resource-collection>
    114                         <web-resource-name>ComponentRegistry access</web-resource-name>
    115                         <description />
    116                         <url-pattern>/*</url-pattern>
    117                         <http-method>GET</http-method>
    118                 </web-resource-collection>
    119                 <auth-constraint>
    120                         <role-name>tomcat</role-name>
    121                 </auth-constraint>
    122         </security-constraint>
    123         <login-config>
    124                 <auth-method>BASIC</auth-method>
    125         </login-config>
    126         <security-role>
    127                 <description> The role that is required to log in to the Application
    128                 </description>
    129                 <role-name>tomcat</role-name>
    130         </security-role>
     21    <filter>
     22        <filter-name>characterEncodingFilter</filter-name>
     23        <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
     24        </filter-class>
     25        <init-param>
     26            <param-name>encoding</param-name>
     27            <param-value>UTF-8</param-value>
     28        </init-param>
     29    </filter>
     30    <filter>
     31        <filter-name>NoCachingFilter</filter-name>
     32        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     33    </filter>
     34    <filter-mapping>
     35        <filter-name>NoCachingFilter</filter-name>
     36        <url-pattern>/rest/registry/*</url-pattern>
     37    </filter-mapping>
     38    <filter-mapping>
     39        <filter-name>characterEncodingFilter</filter-name>
     40        <url-pattern>/*</url-pattern>
     41    </filter-mapping>
     42    <filter>
     43        <filter-name>wicket.componentregistry</filter-name>
     44        <filter-class>org.apache.wicket.protocol.http.WicketFilter
     45        </filter-class>
     46        <init-param>
     47            <param-name>applicationClassName</param-name>
     48            <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
     49            </param-value>
     50        </init-param>
     51        <init-param>
     52            <param-name>configuration</param-name>
     53            <!-- <param-value>development</param-value> -->
     54            <param-value>deployment</param-value>
     55            <!-- you can override with -Dwicket.configuration=development -->
     56        </init-param>
     57    </filter>
     58    <filter-mapping>
     59        <filter-name>wicket.componentregistry</filter-name>
     60        <url-pattern>/admin/*</url-pattern>
     61    </filter-mapping>
     62    <servlet>
     63        <servlet-name>ComponentRegistry Web Application</servlet-name>
     64        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     65        <init-param>
     66            <param-name>com.sun.jersey.config.property.classnames</param-name>
     67            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     68        </init-param>
     69        <init-param>
     70            <param-name>com.sun.jersey.config.property.packages</param-name>
     71            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     72        </init-param>
     73        <load-on-startup>1</load-on-startup>
     74    </servlet>
     75    <servlet-mapping>
     76        <servlet-name>ComponentRegistry Web Application</servlet-name>
     77        <url-pattern>/rest/*</url-pattern>
     78    </servlet-mapping>
     79    <servlet>
     80        <servlet-name>Isocat Servlet</servlet-name>
     81        <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
     82        </servlet-class>
     83        <load-on-startup>1</load-on-startup>
     84    </servlet>
     85    <servlet-mapping>
     86        <servlet-name>Isocat Servlet</servlet-name>
     87        <url-pattern>/isocat/*</url-pattern>
     88    </servlet-mapping>
     89    <servlet>
     90        <servlet-name>JerseyJaxrsConfig</servlet-name>
     91        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     92        <init-param>
     93            <param-name>api.version</param-name>
     94            <param-value>1.0.0</param-value>
     95        </init-param>
     96        <init-param>
     97            <param-name>swagger.api.basepath</param-name>
     98            <param-value>http://localhost:8080/ComponentRegistry/rest</param-value>
     99        </init-param>
     100        <load-on-startup>2</load-on-startup>
     101    </servlet>
     102    <security-constraint>
     103        <display-name>ComponentRegistry web service</display-name>
     104        <web-resource-collection>
     105            <web-resource-name>ComponentRegistry edit</web-resource-name>
     106            <description />
     107            <url-pattern>/rest/*</url-pattern>
     108            <http-method>DELETE</http-method>
     109            <http-method>PUT</http-method>
     110            <http-method>POST</http-method>
     111        </web-resource-collection>
     112        <auth-constraint>
     113            <role-name>tomcat</role-name>
     114        </auth-constraint>
     115    </security-constraint>
     116    <security-constraint>
     117        <display-name>ComponentRegistry SWF GET</display-name>
     118        <web-resource-collection>
     119            <web-resource-name>ComponentRegistry access</web-resource-name>
     120            <description />
     121            <url-pattern>/*</url-pattern>
     122            <http-method>GET</http-method>
     123        </web-resource-collection>
     124        <auth-constraint>
     125            <role-name>tomcat</role-name>
     126        </auth-constraint>
     127    </security-constraint>
     128    <login-config>
     129        <auth-method>BASIC</auth-method>
     130    </login-config>
     131    <security-role>
     132        <description> The role that is required to log in to the Application
     133        </description>
     134        <role-name>tomcat</role-name>
     135    </security-role>
    131136       
    132         <welcome-file-list>
    133                 <welcome-file>index.jsp</welcome-file>
    134         </welcome-file-list>
     137    <welcome-file-list>
     138        <welcome-file>index.jsp</welcome-file>
     139    </welcome-file-list>
    135140       
    136141</web-app>
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/main/webapp/WEB-INF/web.xml

    r5807 r5834  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!-- Configuration file for ComponentRegistry in NON-SHIBBOLIZED context,
    3         i.e. development or testing environments. -->
     3i.e. development or testing environments. -->
    44
    55<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8         <display-name>ComponentRegistry</display-name>
    9         <description>Clarin Metadata Component Registry</description>
    10         <listener>
    11                 <listener-class>org.springframework.web.context.ContextLoaderListener
    12                 </listener-class>
    13         </listener>
     6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     8    <display-name>ComponentRegistry</display-name>
     9    <description>Clarin Metadata Component Registry</description>
     10    <listener>
     11        <listener-class>org.springframework.web.context.ContextLoaderListener
     12        </listener-class>
     13    </listener>
    1414
    15         <context-param>
    16                 <param-name>contextConfigLocation</param-name>
    17                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    18                 </param-value>
    19         </context-param>
     15    <context-param>
     16        <param-name>contextConfigLocation</param-name>
     17        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     18        </param-value>
     19    </context-param>
    2020
    21         <filter>
    22                 <filter-name>characterEncodingFilter</filter-name>
    23                 <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
    24                 </filter-class>
    25                 <init-param>
    26                         <param-name>encoding</param-name>
    27                         <param-value>UTF-8</param-value>
    28                 </init-param>
    29         </filter>
    30         <filter>
    31                 <filter-name>NoCachingFilter</filter-name>
    32                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    33         </filter>
    34         <filter-mapping>
    35                 <filter-name>NoCachingFilter</filter-name>
    36                 <url-pattern>/rest/registry/*</url-pattern>
    37         </filter-mapping>
    38         <filter-mapping>
    39                 <filter-name>characterEncodingFilter</filter-name>
    40                 <url-pattern>/*</url-pattern>
    41         </filter-mapping>
    42         <filter>
    43                 <filter-name>wicket.componentregistry</filter-name>
    44                 <filter-class>org.apache.wicket.protocol.http.WicketFilter
    45                 </filter-class>
    46                 <init-param>
    47                         <param-name>applicationClassName</param-name>
    48                         <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
    49                         </param-value>
    50                 </init-param>
    51                 <init-param>
    52                         <param-name>configuration</param-name>
    53                         <!-- <param-value>development</param-value> -->
    54                         <param-value>deployment</param-value>
    55                         <!-- you can override with -Dwicket.configuration=development -->
    56                 </init-param>
    57         </filter>
    58         <filter-mapping>
    59                 <filter-name>wicket.componentregistry</filter-name>
    60                 <url-pattern>/admin/*</url-pattern>
    61         </filter-mapping>
    62         <servlet>
    63                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    64                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    65                 <init-param> <param-name>com.sun.jersey.config.property.classnames</param-name>
    66                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
    67                 </init-param>
    68                 <load-on-startup>1</load-on-startup>
    69         </servlet>
    70         <servlet-mapping>
    71                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    72                 <url-pattern>/rest/*</url-pattern>
    73         </servlet-mapping>
    74         <servlet>
    75                 <servlet-name>Isocat Servlet</servlet-name>
    76                 <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
    77                 </servlet-class>
    78                 <load-on-startup>1</load-on-startup>
    79         </servlet>
    80         <servlet-mapping>
    81                 <servlet-name>Isocat Servlet</servlet-name>
    82                 <url-pattern>/isocat/*</url-pattern>
    83         </servlet-mapping>
    84         <security-constraint>
    85                 <display-name>ComponentRegistry web service</display-name>
    86                 <web-resource-collection>
    87                         <web-resource-name>ComponentRegistry edit</web-resource-name>
    88                         <description />
    89                         <url-pattern>/rest/*</url-pattern>
    90                         <http-method>DELETE</http-method>
    91                         <http-method>PUT</http-method>
    92                         <http-method>POST</http-method>
    93                 </web-resource-collection>
    94                 <auth-constraint>
    95                         <role-name>tomcat</role-name>
    96                 </auth-constraint>
    97         </security-constraint>
    98         <security-constraint>
    99                 <display-name>ComponentRegistry SWF GET</display-name>
    100                 <web-resource-collection>
    101                         <web-resource-name>ComponentRegistry access</web-resource-name>
    102                         <description />
    103                         <url-pattern>/*</url-pattern>
    104                         <http-method>GET</http-method>
    105                 </web-resource-collection>
    106                 <auth-constraint>
    107                         <role-name>tomcat</role-name>
    108                 </auth-constraint>
    109         </security-constraint>
    110         <login-config>
    111                 <auth-method>BASIC</auth-method>
    112         </login-config>
    113         <security-role>
    114                 <description> The role that is required to log in to the Application
    115                 </description>
    116                 <role-name>tomcat</role-name>
    117         </security-role>
     21    <filter>
     22        <filter-name>characterEncodingFilter</filter-name>
     23        <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
     24        </filter-class>
     25        <init-param>
     26            <param-name>encoding</param-name>
     27            <param-value>UTF-8</param-value>
     28        </init-param>
     29    </filter>
     30    <filter>
     31        <filter-name>NoCachingFilter</filter-name>
     32        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     33    </filter>
     34    <filter-mapping>
     35        <filter-name>NoCachingFilter</filter-name>
     36        <url-pattern>/rest/registry/*</url-pattern>
     37    </filter-mapping>
     38    <filter-mapping>
     39        <filter-name>characterEncodingFilter</filter-name>
     40        <url-pattern>/*</url-pattern>
     41    </filter-mapping>
     42    <filter>
     43        <filter-name>wicket.componentregistry</filter-name>
     44        <filter-class>org.apache.wicket.protocol.http.WicketFilter
     45        </filter-class>
     46        <init-param>
     47            <param-name>applicationClassName</param-name>
     48            <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
     49            </param-value>
     50        </init-param>
     51        <init-param>
     52            <param-name>configuration</param-name>
     53            <!-- <param-value>development</param-value> -->
     54            <param-value>deployment</param-value>
     55            <!-- you can override with -Dwicket.configuration=development -->
     56        </init-param>
     57    </filter>
     58    <filter-mapping>
     59        <filter-name>wicket.componentregistry</filter-name>
     60        <url-pattern>/admin/*</url-pattern>
     61    </filter-mapping>
     62    <servlet>
     63        <servlet-name>ComponentRegistry Web Application</servlet-name>
     64        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     65        <init-param>
     66            <param-name>com.sun.jersey.config.property.classnames</param-name>
     67            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     68        </init-param>
     69        <init-param>
     70            <param-name>com.sun.jersey.config.property.packages</param-name>
     71            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     72        </init-param>
     73        <load-on-startup>1</load-on-startup>
     74    </servlet>
     75    <servlet-mapping>
     76        <servlet-name>ComponentRegistry Web Application</servlet-name>
     77        <url-pattern>/rest/*</url-pattern>
     78    </servlet-mapping>
     79    <servlet>
     80        <servlet-name>Isocat Servlet</servlet-name>
     81        <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
     82        </servlet-class>
     83        <load-on-startup>1</load-on-startup>
     84    </servlet>
     85    <servlet-mapping>
     86        <servlet-name>Isocat Servlet</servlet-name>
     87        <url-pattern>/isocat/*</url-pattern>
     88    </servlet-mapping>
     89    <servlet>
     90        <servlet-name>JerseyJaxrsConfig</servlet-name>
     91        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     92        <init-param>
     93            <param-name>api.version</param-name>
     94            <param-value>1.0.0</param-value>
     95        </init-param>
     96        <init-param>
     97            <param-name>swagger.api.basepath</param-name>
     98            <param-value>http://localhost:8080/ComponentRegistry/rest</param-value>
     99        </init-param>
     100        <load-on-startup>2</load-on-startup>
     101    </servlet>
     102    <security-constraint>
     103        <display-name>ComponentRegistry web service</display-name>
     104        <web-resource-collection>
     105            <web-resource-name>ComponentRegistry edit</web-resource-name>
     106            <description />
     107            <url-pattern>/rest/*</url-pattern>
     108            <http-method>DELETE</http-method>
     109            <http-method>PUT</http-method>
     110            <http-method>POST</http-method>
     111        </web-resource-collection>
     112        <auth-constraint>
     113            <role-name>tomcat</role-name>
     114        </auth-constraint>
     115    </security-constraint>
     116    <security-constraint>
     117        <display-name>ComponentRegistry SWF GET</display-name>
     118        <web-resource-collection>
     119            <web-resource-name>ComponentRegistry access</web-resource-name>
     120            <description />
     121            <url-pattern>/*</url-pattern>
     122            <http-method>GET</http-method>
     123        </web-resource-collection>
     124        <auth-constraint>
     125            <role-name>tomcat</role-name>
     126        </auth-constraint>
     127    </security-constraint>
     128    <login-config>
     129        <auth-method>BASIC</auth-method>
     130    </login-config>
     131    <security-role>
     132        <description> The role that is required to log in to the Application
     133        </description>
     134        <role-name>tomcat</role-name>
     135    </security-role>
    118136       
    119         <welcome-file-list>
    120                 <welcome-file>index.jsp</welcome-file>
    121         </welcome-file-list>
     137    <welcome-file-list>
     138        <welcome-file>index.jsp</welcome-file>
     139    </welcome-file-list>
    122140       
    123141</web-app>
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/test/java

  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RestGroupServiceTest.java

    r5823 r5834  
    5151 *
    5252 * B
    53  *      Owner: Dummy
     53 *      Owner: anotherPrincipal
    5454 *      Members: Dummy
    5555 *      Items: Bprofile-1, Bcomponent-1, Bcomponent-2
     
    220220    }
    221221
    222  //    Response createNewGroup(String groupName) throws IOException;
    223     @Test
    224     public void testCreateNewGroup() {
    225         System.out.println("test createNewGroup");
    226         ClientResponse cr = this.getAuthenticatedResource(getResource()
    227                 .path("/registry/groups/create").queryParam("groupName", "newGroup"))
    228                 .accept(MediaType.TEXT_XML).post(ClientResponse.class);
    229         assertEquals(200, cr.getStatus());
    230         assertEquals("Group with the name newGroup is created and given an id 1", cr.getEntity(String.class));
    231     }
    232 
    233 //  List<Group> getGroupsOwnedByUser(String pricipalName) throws IOException;
    234     @Test
    235     public void testGetGroupsOwnedByUser() {
    236         System.out.println("test GetGroupsOwnedByUser");
    237         ClientResponse cr = this.getAuthenticatedResource(getResource()
    238                 .path("/registry/groups/create").queryParam("groupName", "newGroup1"))
    239                 .accept(MediaType.TEXT_XML).post(ClientResponse.class);
    240         assertEquals(200, cr.getStatus());
    241         ClientResponse cr1 = this.getAuthenticatedResource(getResource()
    242                 .path("/registry/groups/create").queryParam("groupName", "newGroup2"))
    243                 .accept(MediaType.TEXT_XML).post(ClientResponse.class);
    244         assertEquals(200, cr1.getStatus());
    245 
    246         // test itself
    247         List<Group> result = this.getAuthenticatedResource(getResource()
    248                 .path("/registry/groups/principal").queryParam("principalName", DummyPrincipal.DUMMY_PRINCIPAL.getName()))
    249                 .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
    250 
    251         assertEquals(2, result.size());
    252         assertEquals("newGroup1", result.get(0).getName());
    253         assertEquals("newGroup2", result.get(1).getName());
    254     }
    255222
    256223//    List<Group> getGroupsTheCurrentUserIsAMemberOf();   
     
    270237        assertEquals("group B", result.get(0).getName());
    271238    }
    272 //   
    273 //    List<Group> getGroupsTheItemIsAMemberOf(String itemId);
    274 
    275     @Test
    276     public void testGetGroupsTheItemIsAMemberOf() throws ParseException, JAXBException, ItemNotFoundException {
    277         System.out.println("test getGroupsTheItemIsAMemberOf");
    278 
    279         fillUpGroupA();
    280         fillUpGroupB();
    281         // test itself
    282 
    283         List<Group> result = this.getAuthenticatedResource(getResource()
    284                 .path("/registry/items/" + ComponentDescription.COMPONENT_PREFIX + "component-1/groups"))
    285                 .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
    286 
    287         assertEquals(1, result.size());
    288         assertEquals("group A", result.get(0).getName());
    289 
    290         result = this.getAuthenticatedResource(getResource()
    291                 .path("/registry/items/" + ComponentDescription.COMPONENT_PREFIX + "Bcomponent-1/groups"))
    292                 .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
    293 
    294         assertEquals(1, result.size());
    295         assertEquals("group B", result.get(0).getName());
    296 
    297         result = this.getAuthenticatedResource(getResource()
    298                 .path("/registry/items/" + ProfileDescription.PROFILE_PREFIX + "Bprofile-1/groups"))
    299                 .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
    300 
    301         assertEquals(1, result.size());
    302         assertEquals("group B", result.get(0).getName());
    303 
    304         result = this.getAuthenticatedResource(getResource()
    305                 .path("/registry/items/" + ProfileDescription.PROFILE_PREFIX + "profile-1/groups"))
    306                 .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
    307 
    308         assertEquals(1, result.size());
    309         assertEquals("group A", result.get(0).getName());
    310     }
    311 
    312     @Test
    313     public void testListGroupNames() throws ItemNotFoundException {
    314         System.out.println("test listGroupNames");
    315 
    316         MakeGroupA();
    317         MakeGroupB();
    318 
    319         // test itself
    320         ClientResponse cr = this.getAuthenticatedResource(getResource()
    321                 .path("/registry/groups/names")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    322         assertEquals(200, cr.getStatus());
    323         List<String> result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
    324         assertEquals(2, result.size());
    325         assertEquals("group A", result.get(0));
    326         assertEquals("group B", result.get(1));
    327     }
    328 
    329 //
    330 //    Response isOwner(String groupName) throws IOException;
    331     @Test
    332     public void testIsOwner() throws ItemNotFoundException {
    333         System.out.println("test isOwner");
    334 
    335         MakeGroupA();
    336         MakeGroupB();
    337 
    338         // test itself
    339         ClientResponse cr = this.getAuthenticatedResource(getResource()
    340                 .path("/registry/groups/ownership").queryParam("groupName", "group A")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    341         assertEquals(200, cr.getStatus());
    342         String result = cr.getEntity(String.class);
    343         assertEquals("true", result);
    344 
    345         cr = this.getAuthenticatedResource(getResource()
    346                 .path("/registry/groups/ownership").queryParam("groupName", "group B")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    347         assertEquals(200, cr.getStatus());
    348         result = cr.getEntity(String.class);
    349         assertEquals("false", result);
    350     }
    351 
    352 //
    353 //    Response makeGroupMember(String groupName, String principalName) throws IOException;
    354     @Test
    355     public void testMakeGroupMember() throws ItemNotFoundException {
    356         System.out.println("test makeGroupMember");
    357 
    358         MakeGroupA();
    359         MakeGroupB();
    360         // test itself
    361 
    362         //MultivaluedMap<String, String> params  = new  MultivaluedHashMap<String, String>();
    363         ClientResponse cr = this.getAuthenticatedResource(getResource()
    364                 .path("/registry/groups/makemember").queryParam("groupName", "group A").queryParam("principalName", "anotherPrincipal")).accept(MediaType.APPLICATION_XML).post(ClientResponse.class);
    365         assertEquals(200, cr.getStatus());
    366 
    367         assertTrue(groupService.userGroupMember("anotherPrincipal", 1));
    368         ;
    369         cr = this.getAuthenticatedResource(getResource()
    370                 .path("/registry/groups/makemember").queryParam("groupName", "group B").queryParam("principalName", "anotherPrincipal")).accept(MediaType.APPLICATION_XML).post(ClientResponse.class);
    371         assertEquals(403, cr.getStatus());
    372     }
    373 
    374 //
    375 //   Response listProfiles(String groupId) throws IOException;
    376     @Test
    377     public void testListProfilesAndComponents() throws Exception {
    378         System.out.println("test listProfilesAndComponents");
    379 
    380         fillUpGroupA();
    381 
    382         // test itself
    383         ClientResponse cr = this.getAuthenticatedResource(getResource()
    384                 .path("/registry/groups/profiles").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    385         assertEquals(200, cr.getStatus());
    386         List<String> result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
    387         assertEquals(1, result.size());
    388         assertEquals(ProfileDescription.PROFILE_PREFIX + "profile-1", result.get(0));
    389 
    390         cr = this.getAuthenticatedResource(getResource()
    391                 .path("/registry/groups/components").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    392         assertEquals(200, cr.getStatus());
    393         result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
    394         assertEquals(2, result.size());
    395         assertEquals(ComponentDescription.COMPONENT_PREFIX + "component-1", result.get(0));
    396         assertEquals(ComponentDescription.COMPONENT_PREFIX + "component-2", result.get(1));
    397     }
    398 
    399 //
    400 //    Response getGroupNameById(String groupId) throws IOException;
    401     @Test
    402     public void testGetGroupNamebyId() throws Exception {
    403         System.out.println("test getGroupNamebyId");
    404 
    405         MakeGroupA();
    406         MakeGroupB();
    407         // test itself
    408 
    409         ClientResponse cr = this.getAuthenticatedResource(getResource()
    410                 .path("/registry/groups/nameById").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    411         assertEquals(200, cr.getStatus());
    412         String result = cr.getEntity(String.class);
    413         assertEquals("group A", result);
    414 
    415         cr = this.getAuthenticatedResource(getResource()
    416                 .path("/registry/groups/nameById").queryParam("groupId", "2")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    417         assertEquals(200, cr.getStatus());
    418         result = cr.getEntity(String.class);
    419         assertEquals("group B", result);
    420     }
    421 
    422 //
    423 //    Response getGroupIdByName(String groupName) throws IOException;
    424     @Test
    425     public void testGetIdByGroupName() throws Exception {
    426         System.out.println("test getIdByGroupName");
    427 
    428         MakeGroupA();
    429         MakeGroupB();
    430         // test itself
    431 
    432         ClientResponse cr = this.getAuthenticatedResource(getResource()
    433                 .path("/registry/groups/idByName").queryParam("groupName", "group B")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    434         assertEquals(200, cr.getStatus());
    435         String result = cr.getEntity(String.class);
    436         assertEquals("2", result);
    437 
    438         cr = this.getAuthenticatedResource(getResource()
    439                 .path("/registry/groups/idByName").queryParam("groupName", "group A")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
    440         assertEquals(200, cr.getStatus());
    441         result = cr.getEntity(String.class);
    442         assertEquals("1", result);
    443     }
    444 
    445239//    Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;   
    446240//   
  • ComponentRegistry/branches/ComponentRegistry-oauth-1.14.0/docs

Note: See TracChangeset for help on using the changeset viewer.