@@ -0,0 +1,1125 @@
+package org.sagebionetworks.auth;%0D%0A%0D%0Aimport static org.junit.Assert.assertEquals;%0D%0A%0D%0Aimport java.net.URLEncoder;%0D%0A%0D%0Aimport org.junit.After;%0D%0Aimport org.junit.Before;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Apublic class ResourceAccessManagerTest %7B%0D%0A%0D%0A%09@Before%0D%0A%09public void setUp() throws Exception %7B%0D%0A%09%7D%0D%0A%0D%0A%09@After%0D%0A%09public void tearDown() throws Exception %7B%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test %0D%0A%09public void testResourceAccessToken() throws Exception %7B%0D%0A%09%09// generate a resource access token and then check that it's URL safe%0D%0A%09%09String sessionToken = %22zfcN5W9ZM0NknT2NvPUPBg00%22;%0D%0A%09%09String resourceName = %22ComputeResource%22;%0D%0A%09%09String encryptionKey = %2220c832f5c262b9d228c721c190567ae0%22;%0D%0A%09%09String resourceAccessToken = ResourceAccessManager.createResourceAccessToken(sessionToken, resourceName, encryptionKey);%0D%0A%09%09// we check URL safety by seeing if URL-encoding changes the string.%0D%0A%09%09// the one adjustment we have to make is to change '+' to ' ' (space), since%0D%0A%09%09// '+' is URL safe but is percent-encoded, since space is URL encoded as '+'.%0D%0A%09%09assertEquals(resourceAccessToken, URLEncoder.encode(resourceAccessToken.replace('+', ' '), %22UTF-8%22));%0D%0A%09%7D%0D%0A%0D%0A%7D%0D%0A

test for URL safe resource access token