KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > test > cms > stress > TestContentCommand


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.test.cms.stress;
10
11 import org.jboss.portal.cms.NodeFactory;
12 import org.jboss.portal.cms.NodeException;
13 import org.jboss.portal.cms.Node;
14 import org.jboss.portal.cms.Content;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @version $Revision: 1.1 $
19  */

20 public class TestContentCommand extends Command
21 {
22
23    private String JavaDoc uri;
24    private String JavaDoc s;
25
26    public TestContentCommand(String JavaDoc uri, String JavaDoc s)
27    {
28       this.uri = uri;
29       this.s = s;
30    }
31
32    public void execute(Client.Result result, NodeFactory factory) throws NodeException
33    {
34       Node node = factory.getNode(uri);
35       result.assertTrue(node.exists(), uri + " does not exists");
36       result.assertFalse(node.isDir(), uri + " is a dir");
37       Content content = node.getContent();
38       String JavaDoc s = new String JavaDoc(content.getBytes());
39       result.assertTrue(this.s.equals(s), this.s + " != " + s);
40    }
41
42    protected String JavaDoc describe()
43    {
44       return "[testcontent," + uri + "," + s + "]";
45    }
46 }
47
Popular Tags