server.creator()
);
//
// Parse the node XML to create the AppleBean.
final AppleNode created = creator.read(
new StringResource(
"<node xmlns='urn:metagrid' type='urn:metagrid.apple'>"
+ " <properties>"
+ " <property type='urn:metagrid.apple.weight'>27</property>"
+ " <property type='urn:metagrid.fruit.modified'>2008-11-29T06:25:50.379+0000</property>"
+ " </properties>"
+ "</node>"
).reader()
);
//
// Check the AppleNode weight.
assertEquals(
"27",
created.properties().get(
AppleNode.WEIGHT_PROPERTY_URI
).value()
);
//
// Check the AppleBean weight.
assertEquals(
new Integer(27),
created.object().weight()
);
//
// Create our XMLNodeReader.
final XMLNodeReader<AppleNode> updator = new XMLNodeReaderImpl<AppleNode>(
server.updator()
);
//
// Parse the node XML to update the AppleNode.
final AppleNode updatable = updator.read(
new StringResource(
"<node xmlns='urn:metagrid' ident='" + created.ident() + "' type='urn:metagrid.apple'/>"
).reader()
);
//
// Check the AppleNode weight.
assertEquals(
"27",
updatable.properties().get(
AppleNode.WEIGHT_PROPERTY_URI
).value()
);
//
// Check the AppleBean weight.
assertEquals(
new Integer(27),
updatable.object().weight()
);
//
// Modify the AppleNode weight.
updatable.properties().set(
AppleNode.WEIGHT_PROPERTY_URI,
"31"
);
//
// Save (commit) the transaction.
//
//
// Create our XMLNodeReader.
final XMLNodeReader<AppleNode> selector = new XMLNodeReaderImpl<AppleNode>(
server.selector()
);
//
// Parse the node XML to select the AppleNode.
final AppleNode selected = selector.read(
new StringResource(
"<node xmlns='urn:metagrid' ident='" + created.ident() + "' type='urn:metagrid.apple'/>"
).reader()
);
//
// Check the AppleNode weight.