use of org.geosdi.geoplatform.response.ShortAccountDTO in project geo-platform by geosdi.
the class WSAccountTest method testAllOrganizationAccounts.
@Test
public void testAllOrganizationAccounts() throws Exception {
// Initial test
List<ShortAccountDTO> accountList = gpWSClient.getAccounts(organizationNameTest).getAccounts();
assertNotNull(accountList);
int numAccounts = accountList.size();
logger.info("\n*** Number of Accounts for Organization \"{}\": {} ***", organizationNameTest, numAccounts);
for (ShortAccountDTO account : accountList) {
assertEquals(organizationNameTest, account.getOrganization());
}
// Insert User of the organization for test
this.createAndInsertUser("to_search", organizationTest, USER);
// Insert the other Organization and a User for it
GPOrganization otherOrganization = new GPOrganization("other_organization_ws_test");
Long otherOrganizationID = gpWSClient.insertOrganization(otherOrganization);
this.createAndInsertUser("none_search", otherOrganization, USER);
// Final test
accountList = gpWSClient.getAccounts(organizationNameTest).getAccounts();
assertNotNull(accountList);
assertEquals(numAccounts + 1, accountList.size());
for (ShortAccountDTO account : accountList) {
assertEquals(organizationNameTest, account.getOrganization());
}
// Delete the other Organization
gpWSClient.deleteOrganization(otherOrganizationID);
}
use of org.geosdi.geoplatform.response.ShortAccountDTO in project geo-platform by geosdi.
the class RSAccountTest method testAllOrganizationAccountsRest.
@Test
public void testAllOrganizationAccountsRest() throws Exception {
// Initial test
List<ShortAccountDTO> accountList = gpWSClient.getAccounts(organizationNameRSTest).getAccounts();
Assert.assertNotNull(accountList);
int numAccounts = accountList.size();
logger.info("\n*** Number of Accounts for Organization \"{}\": {} ***", organizationNameRSTest, numAccounts);
for (ShortAccountDTO account : accountList) {
Assert.assertEquals(organizationNameRSTest, account.getOrganization());
}
// Insert User of the organization for test
this.createAndInsertUser("to_search", organizationTest, GPRole.USER);
// Insert the other Organization and a User for it
GPOrganization otherOrganization = new GPOrganization("other_organization_ws_test");
Long otherOrganizationID = gpWSClient.insertOrganization(otherOrganization);
this.createAndInsertUser("none_search", otherOrganization, GPRole.USER);
// Final test
accountList = gpWSClient.getAccounts(organizationNameRSTest).getAccounts();
Assert.assertNotNull(accountList);
Assert.assertEquals(numAccounts + 1, accountList.size());
for (ShortAccountDTO account : accountList) {
Assert.assertEquals(organizationNameRSTest, account.getOrganization());
}
// Delete the other Organization
gpWSClient.deleteOrganization(otherOrganizationID);
}
use of org.geosdi.geoplatform.response.ShortAccountDTO in project geo-platform by geosdi.
the class ShortAccountDTOFactoryMassiveTest method testShortAccountFactory.
@Test
public void testShortAccountFactory() throws InterruptedException, ExecutionException {
ExecutorService executor = Executors.newFixedThreadPool(2);
List<Callable<ShortAccountDTO>> tasks = new ArrayList<Callable<ShortAccountDTO>>(1000);
for (int i = 0; i < 1000; i++) {
if (i < 500) {
tasks.add(new CallableEntity(createGPUser(i)));
} else {
tasks.add(new CallableEntity(createGPApplication(i)));
}
}
List<Future<ShortAccountDTO>> results = executor.invokeAll(tasks);
executor.shutdown();
boolean flag = executor.awaitTermination(1, TimeUnit.MINUTES);
if (flag) {
for (Future<ShortAccountDTO> future : results) {
logger.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@ {}\n", future.get());
}
} else {
throw new InterruptedException("Some Threads are not executed.");
}
}
use of org.geosdi.geoplatform.response.ShortAccountDTO in project geo-platform by geosdi.
the class AccountDTOFactory method buildShortAccountDTOList.
/**
* @param accounts
* @return {@link List<ShortAccountDTO>}
*/
public static List<ShortAccountDTO> buildShortAccountDTOList(List<GPAccount> accounts) {
checkNotNull(accounts, "The List of Accounts " + "must not be null.");
List<ShortAccountDTO> accountsDTO = new ArrayList<>(accounts.size());
for (GPAccount account : accounts) {
accountsDTO.add(buildAccountDTO(account));
}
return accountsDTO;
}
use of org.geosdi.geoplatform.response.ShortAccountDTO in project geo-platform by geosdi.
the class WSAccountTest method testAllAccounts.
@Test
public void testAllAccounts() {
List<ShortAccountDTO> accountList = gpWSClient.getAllAccounts().getAccounts();
assertNotNull(accountList);
logger.info("\n*** Number of Accounts into DB: {} ***", accountList.size());
for (ShortAccountDTO account : accountList) {
if (account instanceof UserDTO) {
logger.info("\n*** User into DB:\n{}\n***", (UserDTO) account);
} else if (account instanceof ApplicationDTO) {
logger.info("\n*** Application into DB:\n{}\n***", (ApplicationDTO) account);
}
}
}
Aggregations