1 4 package com.tc.objectserver.l1.api; 5 6 import com.tc.exception.ImplementMe; 7 import com.tc.net.protocol.tcm.ChannelID; 8 import com.tc.object.ObjectID; 9 import com.tc.objectserver.managedobject.BackReferences; 10 import com.tc.text.PrettyPrinter; 11 12 import java.util.ArrayList ; 13 import java.util.Collection ; 14 import java.util.Collections ; 15 import java.util.HashSet ; 16 import java.util.Iterator ; 17 import java.util.List ; 18 import java.util.Set ; 19 20 public class TestClientStateManager implements ClientStateManager { 21 22 public boolean shutdownClientCalled = false; 23 public Collection allClientIDs = new HashSet (); 24 public List addReferenceCalls = new ArrayList (); 25 26 public void shutdownClient(ChannelID deadClient) { 27 this.shutdownClientCalled = true; 28 } 29 30 public void addReference(ChannelID clientID, ObjectID objectID) { 31 addReferenceCalls.add(new AddReferenceContext(clientID, objectID)); 32 } 33 34 public static class AddReferenceContext { 35 public final ChannelID clientID; 36 public final ObjectID objectID; 37 38 private AddReferenceContext(ChannelID clientID, ObjectID objectID) { 39 this.clientID = clientID; 40 this.objectID = objectID; 41 } 42 } 43 44 public void removeReferences(ChannelID clientID, Set removed) { 45 } 47 48 public List createPrunedChangesAndAddObjectIDTo(Collection changes, BackReferences includeIDs, ChannelID clientID, 49 Set objectIDs) { 50 return Collections.EMPTY_LIST; 51 } 52 53 54 public boolean hasReference(ChannelID clientID, ObjectID objectID) { 55 return false; 57 } 58 59 public void addAllReferencedIdsTo(Set rescueIds) { 60 throw new ImplementMe(); 61 62 } 63 64 public PrettyPrinter prettyPrint(PrettyPrinter out) { 65 return out.print(getClass().getName()); 66 } 67 68 public Collection getAllClientIDs() { 69 return allClientIDs; 70 } 71 72 public void stop() { 73 75 } 76 77 public void removeReferencedFrom(ChannelID channelID, Set secondPass) { 78 throw new ImplementMe(); 79 80 } 81 82 public Set addReferences(ChannelID channelID, Set oids) { 83 for (Iterator i = oids.iterator(); i.hasNext();) { 84 ObjectID oid = (ObjectID) i.next(); 85 addReferenceCalls.add(new AddReferenceContext(channelID, oid)); 86 } 87 return oids; 88 } 89 90 } | Popular Tags |