use of com.emc.metalnx.services.tests.tickets.TestTicketUtils in project metalnx-web by irods-contrib.
the class TestTicketAuthenticatedAccess method setUp.
@Before
public void setUp() throws DataGridException, JargonException, IOException {
String parentPath = String.format("/%s/home", zone);
targetPath = String.format("%s/%s", parentPath, username);
ticketUtils = new TestTicketUtils(irodsServices);
ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
localFile = ticketUtils.createLocalFile();
filePath = String.format("%s/%s", targetPath, localFile.getName());
IRODSAccount authIrodsAccount = IRODSAccount.instance(host, Integer.valueOf(port), username, password, targetPath, zone, RESOURCE);
UserTokenDetails userTokenDetails = Mockito.mock(UserTokenDetails.class);
Authentication authentication = Mockito.mock(Authentication.class);
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
SecurityContextHolder.setContext(securityContext);
Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
Mockito.when(authentication.getDetails()).thenReturn(userTokenDetails);
Mockito.when(userTokenDetails.getIrodsAccount()).thenReturn(authIrodsAccount);
}
use of com.emc.metalnx.services.tests.tickets.TestTicketUtils in project metalnx-web by irods-contrib.
the class TestTicketWithUserRestriction method setUp.
@Before
public void setUp() throws DataGridException, JargonException, IOException {
String parentPath = String.format("/%s/home", zone);
targetPath = String.format("%s/%s", parentPath, username);
ticketUtils = new TestTicketUtils(irodsServices);
ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
ticketUtils.addUserRestriction(ticketString, username);
localFile = ticketUtils.createLocalFile();
filePath = String.format("%s/%s", targetPath, localFile.getName());
}
use of com.emc.metalnx.services.tests.tickets.TestTicketUtils in project metalnx-web by irods-contrib.
the class TestTicketWithHostRestriction method setUp.
@Before
public void setUp() throws DataGridException, JargonException, IOException {
String parentPath = String.format("/%s/home", zone);
targetPath = String.format("%s/%s", parentPath, username);
ticketUtils = new TestTicketUtils(irodsServices);
ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
ticketUtils.addHostRestriction(ticketString, host);
localFile = ticketUtils.createLocalFile();
filePath = String.format("%s/%s", targetPath, localFile.getName());
}
use of com.emc.metalnx.services.tests.tickets.TestTicketUtils in project metalnx-web by irods-contrib.
the class TestTicketWithByteLimit method setUp.
@Before
public void setUp() throws DataGridException, JargonException, IOException {
String parentPath = String.format("/%s/home", zone);
targetPath = String.format("%s/%s", parentPath, username);
ticketUtils = new TestTicketUtils(irodsServices);
ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
ticketUtils.setWriteByteLimit(ticketString, WRITE_BYTE_LIMIT);
localFile = ticketUtils.createLocalFile();
filePath = String.format("%s/%s", targetPath, localFile.getName());
}
use of com.emc.metalnx.services.tests.tickets.TestTicketUtils in project metalnx-web by irods-contrib.
the class TestTicketWithFilesLimit method setUp.
@Before
public void setUp() throws DataGridException, JargonException, IOException {
String parentPath = String.format("/%s/home", zone);
targetPath = String.format("%s/%s", parentPath, username);
ticketUtils = new TestTicketUtils(irodsServices);
ticketString = ticketUtils.createTicket(parentPath, username, TicketCreateModeEnum.WRITE);
ticketUtils.setWriteFileLimit(ticketString, WRITE_FILE_LIMIT);
localFile1 = ticketUtils.createLocalFile();
localFile2 = ticketUtils.createLocalFile("test-ticket-2-" + System.currentTimeMillis());
filePath1 = String.format("%s/%s", targetPath, localFile1.getName());
filePath2 = String.format("%s/%s", targetPath, localFile2.getName());
}
Aggregations