KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > node > integrity > IntegrityEventTest


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.node.integrity;
18
19 import java.util.HashSet JavaDoc;
20 import java.util.List JavaDoc;
21 import java.util.Set JavaDoc;
22
23 import junit.framework.TestCase;
24
25 import org.alfresco.service.cmr.dictionary.DictionaryService;
26 import org.alfresco.service.cmr.repository.NodeRef;
27 import org.alfresco.service.cmr.repository.NodeService;
28 import org.alfresco.service.namespace.QName;
29
30 /**
31  * @see org.alfresco.repo.node.integrity.IntegrityEvent
32  *
33  * @author Derek Hulley
34  */

35 public class IntegrityEventTest extends TestCase
36 {
37     private static final String JavaDoc NAMESPACE = "http://test";
38     
39     private NodeRef nodeRef;
40     private QName typeQName;
41     private QName qname;
42     private IntegrityEvent event;
43     
44     public void setUp() throws Exception JavaDoc
45     {
46         nodeRef = new NodeRef("workspace://protocol/ID123");
47         typeQName = QName.createQName(NAMESPACE, "SomeTypeQName");
48         qname = QName.createQName(NAMESPACE, "qname");
49         
50         event = new TestIntegrityEvent(null, null, nodeRef, typeQName, qname);
51     }
52     
53     public void testSetFunctionality() throws Exception JavaDoc
54     {
55         Set JavaDoc<IntegrityEvent> set = new HashSet JavaDoc<IntegrityEvent>(5);
56         boolean added = set.add(event);
57         assertTrue(added);
58         added = set.add(new TestIntegrityEvent(null, null, nodeRef, typeQName, qname));
59         assertFalse(added);
60     }
61     
62     private static class TestIntegrityEvent extends AbstractIntegrityEvent
63     {
64         public TestIntegrityEvent(
65                 NodeService nodeService,
66                 DictionaryService dictionaryService,
67                 NodeRef nodeRef,
68                 QName typeQName,
69                 QName qname)
70         {
71             super(nodeService, dictionaryService, nodeRef, typeQName, qname);
72         }
73
74         public void checkIntegrity(List JavaDoc<IntegrityRecord> eventResults)
75         {
76             throw new UnsupportedOperationException JavaDoc();
77         }
78     }
79 }
80
Popular Tags