| 1 |
|
package net.sf.arestc.core; |
| 2 |
|
|
| 3 |
|
import java.util.Map.Entry; |
| 4 |
|
|
| 5 |
|
|
| 6 |
|
import org.apache.commons.httpclient.methods.EntityEnclosingMethod; |
| 7 |
|
import org.apache.commons.httpclient.methods.PutMethod; |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
|
|
|
| 93.8% |
Uncovered Elements: 1 (16) |
Complexity: 4 |
Complexity Density: 0.36 |
|
| 13 |
|
public class PUTTransformer extends POSTTransformer { |
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
@param |
| 19 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 20 |
2
|
public PUTTransformer(final ConnectorCommand com) {... |
| 21 |
2
|
super(com); |
| 22 |
|
} |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
@param |
| 28 |
|
@param |
| 29 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 30 |
1
|
protected void prepareParameters(final ConnectorRequest request,... |
| 31 |
|
final ConnectorContext context) { |
| 32 |
1
|
for (final Entry<String, Object> entry : request.getParameters() |
| 33 |
|
.entrySet()) { |
| 34 |
3
|
((PutMethod) context.getMethod()).getParams().setParameter( |
| 35 |
|
entry.getKey(), entry.getValue()); |
| 36 |
|
} |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
@see |
| 41 |
|
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 42 |
1
|
@Override... |
| 43 |
|
public void transform(final ConnectorRequest request, |
| 44 |
|
final ConnectorContext context) throws CommandException { |
| 45 |
|
|
| 46 |
1
|
prepareUri(request, context, null); |
| 47 |
1
|
context.setMethod(context.getService().getMethod() |
| 48 |
|
.getMethod(context.getServiceUri().toString())); |
| 49 |
|
|
| 50 |
1
|
prepareParameters(request, context); |
| 51 |
1
|
context.getMethod().addRequestHeader("Content-Type", |
| 52 |
|
context.getService().getContentType()); |
| 53 |
|
|
| 54 |
1
|
((EntityEnclosingMethod) context.getMethod()).setRequestEntity(request |
| 55 |
|
.getBody()); |
| 56 |
|
|
| 57 |
1
|
if (context.getService().isAuthenticationRequired()) { |
| 58 |
1
|
super.authenticate(request, context); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
1
|
return; |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
} |