Map<String, Category> categories = fromXMLToCategoriesMap( outputStream.toString( "UTF-8" ) );
assertEquals( 1,
categories.size() );
Category category = categories.values().iterator().next();
assertEquals( "Category 1",
category.getPath() );
//get 'Category 1/Category 1.1/Category 1.1.1'
client = new AbderaClient( abdera );
client.addCredentials( baseURL.toExternalForm(),
null,
null,
new org.apache.commons.httpclient.UsernamePasswordCredentials( "admin",
"admin" ) );
// resp = client.get(new URL(baseURL, "rest/categories/Category%201%2FCategory%201.1%2FCategory%201.1.1").toExternalForm());
resp = client.get( new URL( baseURL,
"rest/categories/Category%201/Category%201.1/Category%201.1.1" ).toExternalForm() );
assertEquals( ResponseType.SUCCESS,
resp.getType() );
assertEquals( MediaType.APPLICATION_XML,
resp.getContentType().toString() );
document = resp.getDocument();
outputStream = new ByteArrayOutputStream();
document.writeTo( outputStream );
outputStream.close();
categories = fromXMLToCategoriesMap( outputStream.toString( "UTF-8" ) );
assertEquals( 1,
categories.size() );
category = categories.values().iterator().next();
assertEquals( "Category 1/Category 1.1/Category 1.1.1",
category.getPath() );
}