Skip to content

Commit

Permalink
Add new constuctor to make test more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Feb 15, 2024
1 parent c93f774 commit dc57460
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ public DeleteRequest(String path, Object coapRequest) throws InvalidRequestExcep
this(newPath(path), coapRequest);
}

/**
* Creates a request for deleting a particular object instance implemented by a client.
*
* @param path the path of the instance to delete
* @exception InvalidRequestException if the path is not valid.
*/
public DeleteRequest(LwM2mPath path) {
this(path, null);
}

private DeleteRequest(LwM2mPath target, Object coapRequest) {
super(target, coapRequest);
if (target.isRoot())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ public ObserveRequest(ContentFormat format, String path, Map<String, String> con
this(format, newPath(path), context, null);
}

public ObserveRequest(LwM2mPath path) throws InvalidRequestException {
this(null, path, null, null);
}

public ObserveRequest(ContentFormat format, LwM2mPath path, Object coapRequest) throws InvalidRequestException {
this(format, path, null, coapRequest);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,31 @@ public WriteAttributesRequest(int objectId, LwM2mAttributeSet attributes) throws

public WriteAttributesRequest(int objectId, int objectInstanceId, LwM2mAttributeSet attributes)
throws InvalidRequestException {
this(newPath(objectId, objectInstanceId), attributes, null);
this(newPath(objectId, objectInstanceId), attributes);
}

public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, LwM2mAttributeSet attributes)
throws InvalidRequestException {
this(newPath(objectId, objectInstanceId, resourceId), attributes, null);
this(newPath(objectId, objectInstanceId, resourceId), attributes);
}

public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, int resourceInstanceId,
LwM2mAttributeSet attributes) throws InvalidRequestException {
this(newPath(objectId, objectInstanceId, resourceId, resourceInstanceId), attributes, null);
this(newPath(objectId, objectInstanceId, resourceId, resourceInstanceId), attributes);
}

public WriteAttributesRequest(String path, LwM2mAttributeSet attributes) {
this(newPath(path), attributes, null);
this(newPath(path), attributes);
}

public WriteAttributesRequest(String path, LwM2mAttributeSet attributes, Object coapRequest) {
this(newPath(path), attributes, coapRequest);
}

public WriteAttributesRequest(LwM2mPath path, LwM2mAttributeSet attributes) {
this(path, attributes, null);
}

private WriteAttributesRequest(LwM2mPath path, LwM2mAttributeSet attributes, Object coapRequest)
throws InvalidRequestException {
super(path, coapRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,19 @@ public WriteRequest(Mode mode, ContentFormat contentFormat, String path, LwM2mNo
this(mode, contentFormat, newPath(path), node, null);
}

/**
* A generic constructor to write request.
*
* @param mode the mode of the request : replace or update.
* @param contentFormat Format of the payload (TLV,JSON,TEXT,OPAQUE ..).
* @param path the path of the LWM2M node to write (object instance or resource).
* @param node the {@link LwM2mNode} to write.
* @exception InvalidRequestException if parameters are invalid.
*/
public WriteRequest(Mode mode, ContentFormat contentFormat, LwM2mPath path, LwM2mNode node) {
this(mode, contentFormat, path, node, null);
}

/**
* A generic constructor to write request.
*
Expand Down

0 comments on commit dc57460

Please sign in to comment.