Changeset 4102 for cats


Ignore:
Timestamp:
11/28/13 09:33:03 (11 years ago)
Author:
andmor
Message:

Fixed unit tests.

Location:
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml

    r3999 r4102  
    932932      </import>
    933933      <import>
     934         <uri>urn:org:netkernel:client:http</uri>
     935      </import>
     936      <import>
    934937         <uri>urn:org:netkernel:ext:layer1</uri>
    935          <private/>
    936938      </import>
    937939   </rootspace>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/test/testlist.xml

    r3005 r4102  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<testlist>
    3 
    4         <test name="Invoke service by identifier">
     3        <import>res:/org/netkernel/client/http/assertion/httpAssertLibrary.xml</import>
     4        <test name="GET http://localhost:8080/schemacat/site/index.html">
    55                <request>
    6                         <identifier>res:/schemacat/service/Hello</identifier>
     6                        <identifier>active:httpGet</identifier>
     7                        <argument name="url">http://localhost:8080/schemacat/site/index.html</argument>
     8                        <representation>java.lang.String</representation>
    79                </request>
    810                <assert>
    9                         <stringEquals>Input value: Hello</stringEquals>
     11                        <httpReturnCode>200</httpReturnCode>
     12                        <regex><![CDATA[<\?xml version="1.0" encoding="UTF-8"\?>
     13<!DOCTYPE html>
     14<html data-ng-app="SCHEMAcat" lang="en" xmlns="http://www.w3.org/1999/xhtml">
     15    <head>
     16        <meta charset="utf-8"/>
     17        <title>SCHEMAcat - Schema Registry</title>
     18        <link href="images/favicon.ico" rel="shortcut icon"/>
     19        <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
     20        <meta content="A companion registry to the ISOcat Data Category Registry." name="description"/>
     21        <meta content="andmor" name="author"/>]]>.*</regex>
    1022                </assert>
    1123        </test>
    12 
    13         <test name="Invoke service by endpoint">
     24        <test name="GET http://localhost:8080/schemacat/users (Forbidden)">
    1425                <request>
    15                         <identifier>meta:ExampleEndpoint</identifier>
    16                         <argument name="value">Hello</argument>
     26                        <identifier>active:httpGet</identifier>
     27                        <argument name="url">http://localhost:8080/schemacat/users</argument>
     28                        <representation>java.lang.String</representation>
    1729                </request>
    1830                <assert>
    19                         <stringEquals>Input value: Hello</stringEquals>
     31                        <stringEquals><![CDATA[{"html": {
     32    "body": {"img": {"src": "/schemacat/site/images/HTTPstatus/403-Forbidden.jpg"}},
     33    "lang": "en",
     34    "xmlns": "http://www.w3.org/1999/xhtml"
     35}}]]></stringEquals>
     36                </assert>
     37        </test>
     38        <test name="GET http://localhost:8080/schemacat/users/ (Forbidden)">
     39                <request>
     40                        <identifier>active:httpGet</identifier>
     41                        <argument name="url">http://localhost:8080/schemacat/users/</argument>
     42                        <representation>java.lang.String</representation>
     43                </request>
     44                <assert>
     45                        <stringEquals><![CDATA[{"html": {
     46    "body": {"img": {"src": "/schemacat/site/images/HTTPstatus/403-Forbidden.jpg"}},
     47    "lang": "en",
     48    "xmlns": "http://www.w3.org/1999/xhtml"
     49}}]]></stringEquals>
     50                </assert>
     51        </test>
     52        <test name="GET http://localhost:8080/schemacat/users/u0 (json)">
     53                <request>
     54                        <identifier>active:httpGet</identifier>
     55                        <argument name="url">http://localhost:8080/schemacat/users/u0</argument>
     56                        <argument name="headers">
     57                                <literal type="hds">
     58                                        <Accept>application/json</Accept>
     59                                </literal>
     60                        </argument>
     61                        <representation>java.lang.String</representation>
     62                </request>
     63                <assert>
     64                        <httpHeader>
     65                                <Content-Type>application/json</Content-Type>
     66                        </httpHeader>
     67                        <stringEquals><![CDATA[{"sc:user": {
     68    "sc:displayName": "guest",
     69    "sc:principal": "guest",
     70    "sc:role": "guest",
     71    "xml:id": "u0",
     72    "xmlns:sc": "http://www.isocat.org/ns/schemacat"
     73}}]]></stringEquals>
     74                </assert>
     75        </test>
     76        <test name="GET http://localhost:8080/schemacat/users/u0 (xml)">
     77                <request>
     78                        <identifier>active:httpGet</identifier>
     79                        <argument name="url">http://localhost:8080/schemacat/users/u0</argument>
     80                        <argument name="headers">
     81                                <literal type="hds">
     82                                        <Accept>application/xml</Accept>
     83                                </literal>
     84                        </argument>
     85                        <representation>java.lang.String</representation>
     86                </request>
     87                <assert>
     88                        <httpHeader>
     89                                <Content-Type>application/xml</Content-Type>
     90                        </httpHeader>
     91                        <stringEquals><![CDATA[<sc:user xmlns:sc="http://www.isocat.org/ns/schemacat" xml:id="u0">
     92  <sc:principal>guest</sc:principal>
     93  <sc:displayName>guest</sc:displayName>
     94  <sc:role>guest</sc:role>
     95</sc:user>]]></stringEquals>
    2096                </assert>
    2197        </test>
Note: See TracChangeset for help on using the changeset viewer.