assertNotNull(entry.getAuthor().getName());
assertEquals("desc for model1", entry.getSummary());
//assertEquals(MediaType.APPLICATION_OCTET_STREAM_TYPE.getType(), entry.getContentMimeType().getPrimaryType());
assertEquals("/packages/restPackage1/assets/model1/binary", entry.getContentSrc().getPath());
ExtensibleElement metadataExtension = entry.getExtension(Translator.METADATA);
ExtensibleElement archivedExtension = metadataExtension.getExtension(Translator.ARCHIVED);
assertEquals("false", archivedExtension.getSimpleExtension(Translator.VALUE));
ExtensibleElement stateExtension = metadataExtension.getExtension(Translator.STATE);
assertEquals("Draft", stateExtension.getSimpleExtension(Translator.VALUE));
ExtensibleElement formatExtension = metadataExtension.getExtension(Translator.FORMAT);
assertEquals("model.drl", formatExtension.getSimpleExtension(Translator.VALUE));
ExtensibleElement uuidExtension = metadataExtension.getExtension(Translator.UUID);
assertNotNull(uuidExtension.getSimpleExtension(Translator.VALUE));
ExtensibleElement categoryExtension = metadataExtension.getExtension(Translator.CATEGORIES);
assertEquals("AssetPackageResourceTestCategory", categoryExtension.getSimpleExtension(Translator.VALUE));
connection.disconnect();
//Update category. Add a new category tag
categoryExtension.addSimpleExtension(Translator.VALUE, "AssetPackageResourceTestCategory2");
//Update state
stateExtension.getExtension(Translator.VALUE).setText("Dev");
//Update format
formatExtension.getExtension(Translator.VALUE).setText("anotherformat");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("PUT");
connection.setRequestProperty("Content-type", MediaType.APPLICATION_ATOM_XML);
connection.setDoOutput(true);
entry.writeTo(connection.getOutputStream());
assertEquals(204, connection.getResponseCode());
connection.disconnect();
//Verify again
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", MediaType.APPLICATION_ATOM_XML);
connection.connect();
assertEquals (200, connection.getResponseCode());
//System.out.println(GetContent(connection));
in = connection.getInputStream();
assertNotNull(in);
doc = abdera.getParser().parse(in);
entry = doc.getRoot();
metadataExtension = entry.getExtension(Translator.METADATA);
archivedExtension = metadataExtension.getExtension(Translator.ARCHIVED);
assertEquals("false", archivedExtension.getSimpleExtension(Translator.VALUE));
stateExtension = metadataExtension.getExtension(Translator.STATE);
assertEquals("Dev", stateExtension.getSimpleExtension(Translator.VALUE));
formatExtension = metadataExtension.getExtension(Translator.FORMAT);
assertEquals("anotherformat", formatExtension.getSimpleExtension(Translator.VALUE));
categoryExtension = metadataExtension.getExtension(Translator.CATEGORIES);
List<Element> categoryValues = categoryExtension.getExtensions(Translator.VALUE);
assertTrue(categoryValues.size() == 2);
boolean foundCategory1 = false;
boolean foundCategory2 = false;
for (Element cat : categoryValues) {
String catgoryValue = cat.getText();