Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move more tests over to the MockClient
And add a basic test of some of the MockRequests (just to verify that they are detected and executed). Fixup a bug in the HTTP mock request that wouldn't properly fixup commands with space in them. Change-Id: Ib10fb283051daf4e9794b9c7d2a86d482266944a Reviewed-on: http://review.couchbase.org/27909 Reviewed-by: Mark Nunberg <mnunberg@haskalah.org> Tested-by: Trond Norbye <trond.norbye@gmail.com>
- Loading branch information
Showing
7 changed files
with
93 additions
and
201 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/org/couchbase/mock/client/EndureRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2013 Couchbase, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.couchbase.mock.client; | ||
|
||
public class EndureRequest extends MockRequest { | ||
/** | ||
* EndureRequest is used to fake the persistence of a key-value pair | ||
* on a number of nodes. | ||
* | ||
* @param key The key to endure | ||
* @param value An optional value | ||
* @param onMaster Should it be persisted on the master? | ||
* @param numReplicas THe number of replicas to persist it | ||
*/ | ||
public EndureRequest(String key, String value, boolean onMaster, int numReplicas) { | ||
super(); | ||
command.put("command", "endure"); | ||
|
||
payload.put("Key", key); | ||
if (value != null && !value.isEmpty()) { | ||
payload.put("Value", value); | ||
} | ||
payload.put("OnMaster", onMaster); | ||
payload.put("OnReplicas", numReplicas); | ||
command.put("payload", payload); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters