Commit 2b44971c authored by Philippe Coval's avatar Philippe Coval Committed by Gerrit Code Review

Merge "Merge branch '1.3-rel' (c22b1d43)"

parents ffad5c66 4ac85a74
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
*/ */
package org.iotivity.cloud.accountserver.db; package org.iotivity.cloud.accountserver.db;
import java.net.InetAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -50,19 +49,6 @@ public class MongoDB { ...@@ -50,19 +49,6 @@ public class MongoDB {
private MongoClient mongoClient = null; private MongoClient mongoClient = null;
private MongoDatabase db = null; private MongoDatabase db = null;
/**
* API creating MongoClient and initializing MongoDatabase
*
* @param dbname
* database name to create MongoDatabase
* @throws Exception
*/
public MongoDB(String dbname) throws Exception {
mongoClient = new MongoClient(InetAddress.getLocalHost().getHostAddress());
mongoClient.dropDatabase(dbname);
db = mongoClient.getDatabase(dbname);
}
/** /**
* API creating MongoClient and initializing MongoDatabase * API creating MongoClient and initializing MongoDatabase
* *
......
...@@ -66,7 +66,7 @@ public class AccountResourceTest { ...@@ -66,7 +66,7 @@ public class AccountResourceTest {
private static final String REGISTER_URI = Constants.ACCOUNT_FULL_URI; private static final String REGISTER_URI = Constants.ACCOUNT_FULL_URI;
private static final String GROUP_URI = Constants.GROUP_FULL_URI; private static final String GROUP_URI = Constants.GROUP_FULL_URI;
private static final String DEVICE_ID = "DEVICE"; private static final String DEVICE_ID = "DEVICE";
private String mAuthProvider = "Github"; private String mAuthProvider = "github";
private String mAuthCode = "3af038b49edc4ebdc45c"; private String mAuthCode = "3af038b49edc4ebdc45c";
private CoapDevice mMockDevice = mock( private CoapDevice mMockDevice = mock(
CoapDevice.class); CoapDevice.class);
...@@ -112,7 +112,7 @@ public class AccountResourceTest { ...@@ -112,7 +112,7 @@ public class AccountResourceTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.TOKEN_TABLE); mongoDB.createTable(Constants.TOKEN_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
......
...@@ -106,7 +106,7 @@ public class SessionResourceTest { ...@@ -106,7 +106,7 @@ public class SessionResourceTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.TOKEN_TABLE); mongoDB.createTable(Constants.TOKEN_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
...@@ -362,7 +362,7 @@ public class SessionResourceTest { ...@@ -362,7 +362,7 @@ public class SessionResourceTest {
} }
private void resetDB() throws Exception { private void resetDB() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.GROUP_TABLE); mongoDB.deleteTable(Constants.GROUP_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
mongoDB.deleteTable(Constants.USER_TABLE); mongoDB.deleteTable(Constants.USER_TABLE);
......
...@@ -64,7 +64,7 @@ public class TokenRefreshResourceTest { ...@@ -64,7 +64,7 @@ public class TokenRefreshResourceTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.TOKEN_TABLE); mongoDB.createTable(Constants.TOKEN_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
......
...@@ -83,7 +83,7 @@ public class GroupAclManagerTest { ...@@ -83,7 +83,7 @@ public class GroupAclManagerTest {
AclResource.getInstance().deleteAcl((String) AclResource.getInstance() AclResource.getInstance().deleteAcl((String) AclResource.getInstance()
.getAclid(mDi2).get(Constants.KEYFIELD_ACLID)); .getAclid(mDi2).get(Constants.KEYFIELD_ACLID));
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.GROUP_TABLE); mongoDB.deleteTable(Constants.GROUP_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
mongoDB.deleteTable(Constants.ACL_TABLE); mongoDB.deleteTable(Constants.ACL_TABLE);
......
...@@ -78,7 +78,7 @@ public class GroupBrokerTest { ...@@ -78,7 +78,7 @@ public class GroupBrokerTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.TOKEN_TABLE); mongoDB.createTable(Constants.TOKEN_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
...@@ -189,7 +189,7 @@ public class GroupBrokerTest { ...@@ -189,7 +189,7 @@ public class GroupBrokerTest {
} }
private void resetDB() throws Exception { private void resetDB() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.GROUP_TABLE); mongoDB.deleteTable(Constants.GROUP_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
mongoDB.deleteTable(Constants.USER_TABLE); mongoDB.deleteTable(Constants.USER_TABLE);
......
...@@ -108,7 +108,7 @@ public class GroupResourceTest { ...@@ -108,7 +108,7 @@ public class GroupResourceTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.USER_TABLE); mongoDB.deleteTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.deleteTable(Constants.TOKEN_TABLE); mongoDB.deleteTable(Constants.TOKEN_TABLE);
...@@ -824,7 +824,7 @@ public class GroupResourceTest { ...@@ -824,7 +824,7 @@ public class GroupResourceTest {
} }
public void resetDB() throws Exception { public void resetDB() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.GROUP_TABLE); mongoDB.deleteTable(Constants.GROUP_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
mongoDB.deleteTable(Constants.USER_TABLE); mongoDB.deleteTable(Constants.USER_TABLE);
......
...@@ -53,24 +53,26 @@ import org.mockito.invocation.InvocationOnMock; ...@@ -53,24 +53,26 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
public class AclIdResourceTest { public class AclIdResourceTest {
private static final String ACL_ID_URI = Constants.ACL_ID_FULL_URI; private static final String ACL_ID_URI = Constants.ACL_ID_FULL_URI;
final CountDownLatch mLatch = new CountDownLatch(1); final CountDownLatch mLatch = new CountDownLatch(
private final String mDeviceUuid = "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb"; 1);
private final String mOwnerUuid = "123e4567-e89b-12d3-a456-4266554"; private final String mDeviceUuid = "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb";
private final String mSubjectUuid = "72616E64-5069-6E44-6576-5575696"; private final String mOwnerUuid = "123e4567-e89b-12d3-a456-4266554";
private final int mSubjectType = 0; private final String mSubjectUuid = "72616E64-5069-6E44-6576-5575696";
private final int mPermission = 6; private final int mSubjectType = 0;
private final int mSubjectTypeUpdate = 1; private final int mPermission = 6;
private final int mPermissionUpdate = 7; private final int mSubjectTypeUpdate = 1;
private final String mResourceUri = "/a/light/0"; private final int mPermissionUpdate = 7;
private final String mResourceType = "core.light"; private final String mResourceUri = "/a/light/0";
private final String mResourceIf = "oic.if.baseline"; private final String mResourceType = "core.light";
private String mAceId = "a0001"; private final String mResourceIf = "oic.if.baseline";
private String mAclId = "987e6543-e21b-12d3-a456-4266554"; private String mAceId = "a0001";
private CoapDevice mMockDevice = Mockito.mock(CoapDevice.class); private String mAclId = "987e6543-e21b-12d3-a456-4266554";
private Cbor<HashMap<String, Object>> mCbor = new Cbor<>(); private CoapDevice mMockDevice = Mockito
private IResponse mResponse = null; .mock(CoapDevice.class);
private AclResource mAclResource = new AclResource(); private Cbor<HashMap<String, Object>> mCbor = new Cbor<>();
private IResponse mResponse = null;
private AclResource mAclResource = new AclResource();
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
...@@ -79,14 +81,18 @@ public class AclIdResourceTest { ...@@ -79,14 +81,18 @@ public class AclIdResourceTest {
resetDB(); resetDB();
Mockito.doAnswer(new Answer<Object>() { Mockito.doAnswer(new Answer<Object>() {
@Override @Override
public CoapResponse answer(InvocationOnMock invocation) throws Throwable { public CoapResponse answer(InvocationOnMock invocation)
throws Throwable {
Object[] args = invocation.getArguments(); Object[] args = invocation.getArguments();
CoapResponse resp = (CoapResponse) args[0]; CoapResponse resp = (CoapResponse) args[0];
System.out.println("\t----------payload : " + resp.getPayloadString()); System.out.println(
"\t----------payload : " + resp.getPayloadString());
System.out.println("\t---------method : " + resp.getStatus()); System.out.println("\t---------method : " + resp.getStatus());
mResponse = resp; mResponse = resp;
if (mAclId == null) { if (mAclId == null) {
HashMap<String, Object> payloadData = mCbor.parsePayloadFromCbor(resp.getPayload(), HashMap.class); HashMap<String, Object> payloadData = mCbor
.parsePayloadFromCbor(resp.getPayload(),
HashMap.class);
if (payloadData.containsKey("aclid")) { if (payloadData.containsKey("aclid")) {
mAclId = (String) payloadData.get("aclid"); mAclId = (String) payloadData.get("aclid");
} }
...@@ -99,7 +105,7 @@ public class AclIdResourceTest { ...@@ -99,7 +105,7 @@ public class AclIdResourceTest {
@After @After
public void resetAccountDatabase() throws Exception { public void resetAccountDatabase() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.createTable(Constants.USER_TABLE); mongoDB.createTable(Constants.USER_TABLE);
mongoDB.createTable(Constants.ACL_TABLE); mongoDB.createTable(Constants.ACL_TABLE);
mongoDB.createTable(Constants.TOKEN_TABLE); mongoDB.createTable(Constants.TOKEN_TABLE);
...@@ -184,7 +190,8 @@ public class AclIdResourceTest { ...@@ -184,7 +190,8 @@ public class AclIdResourceTest {
assertTrue(mLatch.await(2L, SECONDS)); assertTrue(mLatch.await(2L, SECONDS));
} }
private void createAclId(CoapDevice device, String di, String oid) throws Exception { private void createAclId(CoapDevice device, String di, String oid)
throws Exception {
System.out.println("-----Create Acl Id"); System.out.println("-----Create Acl Id");
IRequest request = null; IRequest request = null;
request = createAclIdRequest(oid, di); request = createAclIdRequest(oid, di);
...@@ -212,21 +219,24 @@ public class AclIdResourceTest { ...@@ -212,21 +219,24 @@ public class AclIdResourceTest {
mAclResource.onDefaultRequestReceived(device, request); mAclResource.onDefaultRequestReceived(device, request);
} }
private void addIndividualAce(CoapDevice device, String aclId) throws Exception { private void addIndividualAce(CoapDevice device, String aclId)
throws Exception {
System.out.println("-----Add Individual Ace"); System.out.println("-----Add Individual Ace");
IRequest request = null; IRequest request = null;
request = addIndividualAceRequest(aclId); request = addIndividualAceRequest(aclId);
mAclResource.onDefaultRequestReceived(device, request); mAclResource.onDefaultRequestReceived(device, request);
} }
private void updateIndividualAce(CoapDevice device, String aclId, String aceId) throws Exception { private void updateIndividualAce(CoapDevice device, String aclId,
String aceId) throws Exception {
System.out.println("-----Update Individual Acl Ace"); System.out.println("-----Update Individual Acl Ace");
IRequest request = null; IRequest request = null;
request = updateIndividualAceRequest(aclId, aceId); request = updateIndividualAceRequest(aclId, aceId);
mAclResource.onDefaultRequestReceived(device, request); mAclResource.onDefaultRequestReceived(device, request);
} }
private void deleteIndividualAclAce(CoapDevice device, String aclId, String aceId) throws Exception { private void deleteIndividualAclAce(CoapDevice device, String aclId,
String aceId) throws Exception {
System.out.println("-----Delete Individual Acl Ace"); System.out.println("-----Delete Individual Acl Ace");
IRequest request = null; IRequest request = null;
request = deleteIndividualAclAceRequest(aclId, aceId); request = deleteIndividualAclAceRequest(aclId, aceId);
...@@ -235,27 +245,32 @@ public class AclIdResourceTest { ...@@ -235,27 +245,32 @@ public class AclIdResourceTest {
private IRequest getAclIdRequest(String deviceUuid) { private IRequest getAclIdRequest(String deviceUuid) {
IRequest request = null; IRequest request = null;
request = MessageBuilder.createRequest(RequestMethod.GET, ACL_ID_URI, "di=" + deviceUuid); request = MessageBuilder.createRequest(RequestMethod.GET, ACL_ID_URI,
"di=" + deviceUuid);
((CoapRequest) request).setObserve(Observe.SUBSCRIBE); ((CoapRequest) request).setObserve(Observe.SUBSCRIBE);
return request; return request;
} }
private IRequest createAclIdRequest(String oid, String di) { private IRequest createAclIdRequest(String oid, String di) {
IRequest request = null; IRequest request = null;
String uriQuery = Constants.REQ_OWNER_ID + "=" + oid + ";" + Constants.REQ_DEVICE_ID + "=" + di; String uriQuery = Constants.REQ_OWNER_ID + "=" + oid + ";"
request = MessageBuilder.createRequest(RequestMethod.PUT, ACL_ID_URI, uriQuery); + Constants.REQ_DEVICE_ID + "=" + di;
request = MessageBuilder.createRequest(RequestMethod.PUT, ACL_ID_URI,
uriQuery);
return request; return request;
} }
private IRequest deleteAclIdRequest(String aclId) { private IRequest deleteAclIdRequest(String aclId) {
IRequest request = null; IRequest request = null;
request = MessageBuilder.createRequest(RequestMethod.DELETE, ACL_ID_URI, "aclid=" + aclId); request = MessageBuilder.createRequest(RequestMethod.DELETE, ACL_ID_URI,
"aclid=" + aclId);
return request; return request;
} }
private IRequest getIndividualAclRequest(String aclId) { private IRequest getIndividualAclRequest(String aclId) {
IRequest request = null; IRequest request = null;
request = MessageBuilder.createRequest(RequestMethod.GET, ACL_ID_URI + "/" + aclId, null); request = MessageBuilder.createRequest(RequestMethod.GET,
ACL_ID_URI + "/" + aclId, null);
((CoapRequest) request).setObserve(Observe.NOTHING); ((CoapRequest) request).setObserve(Observe.NOTHING);
return request; return request;
} }
...@@ -283,8 +298,9 @@ public class AclIdResourceTest { ...@@ -283,8 +298,9 @@ public class AclIdResourceTest {
HashMap<String, Object> payload = new HashMap<>(); HashMap<String, Object> payload = new HashMap<>();
payload.put(Constants.REQ_ACL_LIST, Arrays.asList(acelist)); payload.put(Constants.REQ_ACL_LIST, Arrays.asList(acelist));
return MessageBuilder.createRequest(RequestMethod.POST, ACL_ID_URI + "/" + aclId, null, return MessageBuilder.createRequest(RequestMethod.POST,
ContentFormat.APPLICATION_CBOR, mCbor.encodingPayloadToCbor(payload)); ACL_ID_URI + "/" + aclId, null, ContentFormat.APPLICATION_CBOR,
mCbor.encodingPayloadToCbor(payload));
} }
private IRequest updateIndividualAceRequest(String aclId, String aceId) { private IRequest updateIndividualAceRequest(String aclId, String aceId) {
...@@ -310,18 +326,22 @@ public class AclIdResourceTest { ...@@ -310,18 +326,22 @@ public class AclIdResourceTest {
HashMap<String, Object> payload = new HashMap<>(); HashMap<String, Object> payload = new HashMap<>();
payload.put(Constants.REQ_ACL_LIST, Arrays.asList(acelist)); payload.put(Constants.REQ_ACL_LIST, Arrays.asList(acelist));
return MessageBuilder.createRequest(RequestMethod.POST, ACL_ID_URI + "/" + aclId, "aceid=" + aceId, return MessageBuilder.createRequest(RequestMethod.POST,
ContentFormat.APPLICATION_CBOR, mCbor.encodingPayloadToCbor(payload)); ACL_ID_URI + "/" + aclId, "aceid=" + aceId,
ContentFormat.APPLICATION_CBOR,
mCbor.encodingPayloadToCbor(payload));
} }
private IRequest deleteIndividualAclAceRequest(String aclId, String aceId) { private IRequest deleteIndividualAclAceRequest(String aclId, String aceId) {
IRequest request = null; IRequest request = null;
request = MessageBuilder.createRequest(RequestMethod.DELETE, ACL_ID_URI + "/" + aclId, "aceid=" + aceId); request = MessageBuilder.createRequest(RequestMethod.DELETE,
ACL_ID_URI + "/" + aclId, "aceid=" + aceId);
return request; return request;
} }
private void hashmapGetAclId(IResponse response, String propertyName) { private void hashmapGetAclId(IResponse response, String propertyName) {
HashMap<String, Object> payloadData = mCbor.parsePayloadFromCbor(response.getPayload(), HashMap.class); HashMap<String, Object> payloadData = mCbor
.parsePayloadFromCbor(response.getPayload(), HashMap.class);
if (payloadData.containsKey(propertyName)) { if (payloadData.containsKey(propertyName)) {
mAclId = (String) payloadData.get(propertyName); mAclId = (String) payloadData.get(propertyName);
...@@ -330,16 +350,19 @@ public class AclIdResourceTest { ...@@ -330,16 +350,19 @@ public class AclIdResourceTest {
} }
private void hashmapGetAceId(IResponse response, String propertyName) { private void hashmapGetAceId(IResponse response, String propertyName) {
HashMap<String, Object> payloadData = mCbor.parsePayloadFromCbor(response.getPayload(), HashMap.class); HashMap<String, Object> payloadData = mCbor
.parsePayloadFromCbor(response.getPayload(), HashMap.class);
if (payloadData.containsKey("aclist")) { if (payloadData.containsKey("aclist")) {
List<HashMap<String, Object>> aclist = (List<HashMap<String, Object>>) payloadData.get("aclist"); List<HashMap<String, Object>> aclist = (List<HashMap<String, Object>>) payloadData
.get("aclist");
mAceId = (String) aclist.get(0).get(propertyName); mAceId = (String) aclist.get(0).get(propertyName);
System.out.println("hashmapGetAceId getace " + mAceId); System.out.println("hashmapGetAceId getace " + mAceId);
} }
} }
private boolean hashmapCheck(IResponse response, String propertyName) { private boolean hashmapCheck(IResponse response, String propertyName) {
HashMap<String, Object> payloadData = mCbor.parsePayloadFromCbor(response.getPayload(), HashMap.class); HashMap<String, Object> payloadData = mCbor
.parsePayloadFromCbor(response.getPayload(), HashMap.class);
if (payloadData.containsKey(propertyName)) { if (payloadData.containsKey(propertyName)) {
return true; return true;
} else { } else {
...@@ -347,7 +370,8 @@ public class AclIdResourceTest { ...@@ -347,7 +370,8 @@ public class AclIdResourceTest {
} }
} }
private boolean methodCheck(IResponse response, ResponseStatus responseStatus) { private boolean methodCheck(IResponse response,
ResponseStatus responseStatus) {
if (responseStatus == response.getStatus()) { if (responseStatus == response.getStatus()) {
return true; return true;
} else { } else {
...@@ -362,7 +386,7 @@ public class AclIdResourceTest { ...@@ -362,7 +386,7 @@ public class AclIdResourceTest {
} }
public void resetDB() throws Exception { public void resetDB() throws Exception {
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.GROUP_TABLE); mongoDB.deleteTable(Constants.GROUP_TABLE);
mongoDB.createTable(Constants.GROUP_TABLE); mongoDB.createTable(Constants.GROUP_TABLE);
mongoDB.deleteTable(Constants.ACL_TABLE); mongoDB.deleteTable(Constants.ACL_TABLE);
......
...@@ -85,7 +85,7 @@ public class InviteResourceTest { ...@@ -85,7 +85,7 @@ public class InviteResourceTest {
mResponse = null; mResponse = null;
// reset data base // reset data base
MongoDB mongoDB = new MongoDB(Constants.DB_NAME); MongoDB mongoDB = new MongoDB("127.0.0.1", Constants.DB_NAME);
mongoDB.deleteTable(Constants.INVITE_TABLE); mongoDB.deleteTable(Constants.INVITE_TABLE);
mongoDB.createTable(Constants.INVITE_TABLE); mongoDB.createTable(Constants.INVITE_TABLE);
......
...@@ -34,7 +34,6 @@ import org.iotivity.cloud.accountserver.Constants; ...@@ -34,7 +34,6 @@ import org.iotivity.cloud.accountserver.Constants;
import org.iotivity.cloud.accountserver.db.MongoDB; import org.iotivity.cloud.accountserver.db.MongoDB;
import org.iotivity.cloud.accountserver.resources.acl.id.AclResource; import org.iotivity.cloud.accountserver.resources.acl.id.AclResource;
import org.iotivity.cloud.base.device.CoapDevice; import org.iotivity.cloud.base.device.CoapDevice;
import org.iotivity.cloud.base.protocols.IRequest; import org.iotivity.cloud.base.protocols.IRequest;
import org.iotivity.cloud.base.protocols.IResponse; import org.iotivity.cloud.base.protocols.IResponse;
import org.iotivity.cloud.base.protocols.MessageBuilder; import org.iotivity.cloud.base.protocols.MessageBuilder;
...@@ -54,24 +53,26 @@ import org.mockito.invocation.InvocationOnMock; ...@@ -54,24 +53,26 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
public class AclVerifyResourceTest { public class AclVerifyResourceTest {
private static final String ACL_ID_URI = Constants.ACL_ID_FULL_URI; private static final String ACL_ID_URI = Constants.ACL_ID_FULL_URI;
private static final String ACL_VERIFY_URI = Constants.ACL_VERIFY_FULL_URI; private static final String ACL_VERIFY_URI = Constants.ACL_VERIFY_FULL_URI;
final CountDownLatch mLatch = new CountDownLatch(1); final CountDownLatch mLatch = new CountDownLatch(
private final String mDeviceUuid = "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb"; 1);
private final String mOwnerUuid = "123e4567-e89b-12d3-a456-4266554"; private final String mDeviceUuid = "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb";
private final String mSubjectUuid = "72616E64-5069-6E44-6576-5575696"; private final String mOwnerUuid = "123e4567-e89b-12d3-a456-4266554";
private final String mRmType = "POST"; private final String mSubjectUuid = "72616E64-5069-6E44-6576-5575696";
private final int mSubjectType = 1; private final String mRmType = "POST";
private final int mPermission = 7; private final int mSubjectType = 1;
private final String mResourceUri = "/a/light/0"; private final int mPermission = 7;
private final String mResourceType = "core.light"; private final String mResourceUri = "/a/light/0";
private final String mResourceIf = "oic.if.baseline"; private final String mResourceType = "core.light";
private String mAclId = "987e6543-e21b-12d3-a456-4266554";