Search in sources :

Example 21 with DataGridTicket

use of com.emc.metalnx.core.domain.entity.DataGridTicket in project metalnx-web by irods-contrib.

the class TicketServiceImpl method findAll.

@Override
public List<DataGridTicket> findAll() throws DataGridConnectionRefusedException {
    logger.info("Find all tickets");
    TicketAdminService tas = irodsServices.getTicketAdminService();
    List<DataGridTicket> dgTickets;
    List<Ticket> tickets;
    try {
        tickets = tas.listAllTickets(OFFSET);
    } catch (JargonException e) {
        logger.info("Could not list all tickets in the grid: {}.", e.getMessage());
        tickets = new ArrayList<>();
    }
    dgTickets = convertListOfTickets(tickets);
    return dgTickets;
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Ticket(org.irods.jargon.ticket.Ticket) JargonException(org.irods.jargon.core.exception.JargonException) ArrayList(java.util.ArrayList) DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) TicketAdminService(org.irods.jargon.ticket.TicketAdminService)

Example 22 with DataGridTicket

use of com.emc.metalnx.core.domain.entity.DataGridTicket in project metalnx-web by irods-contrib.

the class TestFindTicket method testFindTicket.

@Test
public void testFindTicket() throws DataGridConnectionRefusedException, DataGridTicketNotFoundException {
    DataGridTicket dgt = ticketService.find(ticketString);
    assertNotNull(dgt);
    assertFalse(dgt.getTicketString().isEmpty());
    assertTrue(dgt.getPath().equals(targetPath));
    assertTrue(dgt.getOwner().equals(username));
    assertDate(EXPIRATION_DATE, dgt.getExpirationDate());
    assertEquals(USES_LIMIT, dgt.getUsesLimit());
    assertEquals(USES_COUNT, dgt.getUsesCount());
    assertEquals(WRITE_BYTE_LIMIT, dgt.getWriteByteLimit());
    assertEquals(WRITE_BYTE_COUNT, dgt.getWriteByteCount());
    assertEquals(WRITE_FILE_LIMIT, dgt.getWriteFileLimit());
    assertEquals(WRITE_FILE_COUNT, dgt.getWriteFileCount());
    assertEquals(1, dgt.getHosts().size());
    assertEquals(1, dgt.getUsers().size());
    assertTrue(dgt.getUsers().contains(username));
    assertTrue(dgt.getGroups().contains(PUBLIC_GROUP));
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Test(org.junit.Test)

Example 23 with DataGridTicket

use of com.emc.metalnx.core.domain.entity.DataGridTicket in project metalnx-web by irods-contrib.

the class TestTicketService method testListingAllTickets.

@Test
public void testListingAllTickets() throws DataGridConnectionRefusedException {
    List<DataGridTicket> tickets = ticketService.findAll();
    assertNotNull(tickets);
    assertFalse(tickets.isEmpty());
    for (DataGridTicket t : tickets) {
        assertNotNull(t.getPath());
        assertFalse(t.getTicketString().isEmpty());
        assertFalse(t.getOwner().isEmpty());
        assertFalse(t.getTicketString().isEmpty());
    }
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Test(org.junit.Test)

Example 24 with DataGridTicket

use of com.emc.metalnx.core.domain.entity.DataGridTicket in project metalnx-web by irods-contrib.

the class TestCreateTicketWithExpirationDate method setUp.

@Before
public void setUp() throws DataGridException, JargonException {
    String parentPath = String.format("/%s/home", zone);
    targetPath = String.format("%s/%s", parentPath, username);
    ticketUtils = new TestTicketUtils(irodsServices);
    date = new Date();
    dgt = new DataGridTicket(targetPath);
    dgt.setExpirationDate(date);
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Date(java.util.Date) Before(org.junit.Before)

Example 25 with DataGridTicket

use of com.emc.metalnx.core.domain.entity.DataGridTicket in project metalnx-web by irods-contrib.

the class TestCreateTicketWithGroupRestriction method setUp.

@Before
public void setUp() throws DataGridException, JargonException {
    String parentPath = String.format("/%s/home", zone);
    targetPath = String.format("%s/%s", parentPath, username);
    ticketUtils = new TestTicketUtils(irodsServices);
    dgt = new DataGridTicket(targetPath);
    dgt.addGroup(PUBLIC_GROUP);
}
Also used : DataGridTicket(com.emc.metalnx.core.domain.entity.DataGridTicket) Before(org.junit.Before)

Aggregations

DataGridTicket (com.emc.metalnx.core.domain.entity.DataGridTicket)25 Test (org.junit.Test)10 Before (org.junit.Before)7 Ticket (org.irods.jargon.ticket.Ticket)4 UnsupportedDataGridFeatureException (com.emc.metalnx.core.domain.exceptions.UnsupportedDataGridFeatureException)3 JargonException (org.irods.jargon.core.exception.JargonException)3 TicketAdminService (org.irods.jargon.ticket.TicketAdminService)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 Date (java.util.Date)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 DataGridTicketException (com.emc.metalnx.core.domain.exceptions.DataGridTicketException)1 DataGridTicketNotFoundException (com.emc.metalnx.core.domain.exceptions.DataGridTicketNotFoundException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 DataNotFoundException (org.irods.jargon.core.exception.DataNotFoundException)1 TicketCreateModeEnum (org.irods.jargon.ticket.packinstr.TicketCreateModeEnum)1 ResponseEntity (org.springframework.http.ResponseEntity)1