KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > atg > MockRepository


1 package com.mockobjects.atg;
2
3 import atg.repository.*;
4 import com.mockobjects.ExpectationMap;
5 import com.mockobjects.Verifiable;
6 import com.mockobjects.MockObject;
7 import com.mockobjects.ExpectationValue;
8
9 public class MockRepository extends MockObject implements Repository, Verifiable {
10     RepositoryException exception;
11     RepositoryItemDescriptor itemDescriptor;
12     ExpectationMap items = new ExpectationMap("MockRepository items");
13
14     public MockRepository() {
15         super();
16     }
17
18     public String JavaDoc getDefaultViewName() {
19         return null;
20     }
21
22     public RepositoryItem getItem(String JavaDoc id) throws RepositoryException {
23         RepositoryItem result = (RepositoryItem)items.get(id);
24         if (null != exception) {
25             throw exception;
26         }
27
28         return result;
29     }
30
31     public RepositoryItem getItem(String JavaDoc arg1, String JavaDoc arg2) throws RepositoryException {
32         if (exception != null) {
33             throw exception;
34         }
35
36         return null;
37     }
38
39     public RepositoryItemDescriptor getItemDescriptor(String JavaDoc arg1) throws RepositoryException {
40         if (exception != null) {
41             throw exception;
42         }
43
44         return this.itemDescriptor;
45     }
46
47     public java.lang.String JavaDoc[] getItemDescriptorNames() {
48         return null;
49     }
50
51     public atg.repository.RepositoryItem[] getItems(java.lang.String JavaDoc[] arg1) throws RepositoryException {
52         if (exception != null) {
53             throw exception;
54         }
55
56         return null;
57     }
58
59     public atg.repository.RepositoryItem[] getItems(java.lang.String JavaDoc[] arg1, String JavaDoc arg2) throws RepositoryException {
60         if (exception != null) {
61             throw exception;
62         }
63
64         return null;
65     }
66
67     public String JavaDoc getRepositoryName() {
68         return null;
69     }
70
71     public RepositoryView getView(String JavaDoc arg1) throws RepositoryException {
72         if (exception != null) {
73             throw exception;
74         }
75
76         return null;
77     }
78
79     public java.lang.String JavaDoc[] getViewNames() {
80         return null;
81     }
82
83     public void setupException(RepositoryException exception) {
84         this.exception = exception;
85     }
86
87     public void setupRepositoryItemDescriptor(RepositoryItemDescriptor itemDescriptor) {
88         this.itemDescriptor = itemDescriptor;
89     }
90
91     public void addExpectedGetItem(String JavaDoc id, RepositoryItem item) {
92         items.addExpected(id, item);
93     }
94
95     public void setExpectNoItems() {
96         items.setExpectNothing();
97     }
98 }
99
Popular Tags