Project

General

Profile

« Previous | Next » 

Revision 10264

Added by Jing Tao almost 7 years ago

Add some methods to support the replicate.

View differences:

MockCNode.java
37 37
import org.dataone.service.types.v1.Identifier;
38 38
import org.dataone.service.types.v1.NodeReference;
39 39
import org.dataone.service.types.v1.NodeType;
40
import org.dataone.service.types.v1.ReplicationStatus;
40 41
import org.dataone.service.types.v1.Service;
41 42
import org.dataone.service.types.v1.Services;
42 43
import org.dataone.service.types.v1.Session;
......
72 73
		list.addNode(getTestMN());
73 74
		list.addNode(getTestV1MN());
74 75
		list.addNode(getTestV2MN());
76
		list.addNode(getReplicationSourceV2MN());
75 77
		return list;
76 78
	}
77 79
    
......
149 151
            return getTestV1MN();
150 152
        } else if (nodeId != null && nodeId.getValue().equals(V2MNNODEID)) {
151 153
            return getTestV2MN();
154
        } else if (nodeId != null && nodeId.getValue().equals(MockReplicationMNode.NODE_ID)) {
155
            return getReplicationSourceV2MN();
152 156
        } else {
153 157
            return getCapabilities();
154 158
        }
......
218 222
        node.setServices(services);
219 223
        return node;
220 224
    }
225
    
226
    
227
    /*
228
     * Create a v2 mn in this env
229
     */
230
    private Node getReplicationSourceV2MN() {
231
        Node node = new Node();
232
        NodeReference nodeRef = new NodeReference();
233
        nodeRef.setValue(MockReplicationMNode.NODE_ID);
234
        node.setIdentifier(nodeRef);
235
        Subject subject = new Subject();
236
        subject.setValue("cn=" + MockReplicationMNode.NODE_ID + ",dc=dataone,dc=org");
237
        node.addSubject(subject);
238
        node.setType(NodeType.MN);
239
        Service service = new Service();
240
        service.setName("MNRead");
241
        service.setVersion("V1");
242
        service.setAvailable(true);
243
        Service service2 = new Service();
244
        service2.setName("MNRead");
245
        service2.setVersion("V2");
246
        service2.setAvailable(true);
247
        Services services = new Services();
248
        services.addService(service);
249
        services.addService(service2);
250
        node.setServices(services);
251
        return node;
252
    }
253
    
254
    @Override
255
    public boolean setReplicationStatus(Session session, Identifier pid,
256
            NodeReference nodeRef, ReplicationStatus status, BaseException failure)
257
                    throws ServiceFailure, NotImplemented, InvalidToken, NotAuthorized,
258
                    InvalidRequest, NotFound {
259
        return true;
260
    }
221 261
}

Also available in: Unified diff