private void executeToStorage(String aUid, String aValue) { try { iSession.open(); iSession.startTransaction(); String tableName = APPLICATION_PACKAGE_TABLE; StorageEntry entry = new StorageEntry(); entry.addAttribute(new StorageAttribute(VENDOR, aValue)); assertTrue("Populate failed", iJtu.populate(iSession, tableName, aUid, entry)); assertTrue("Check failed", iJtu.checkParams(iSession, tableName, entry, 1)); // Utils add ID to entry entry.removeAttribute(ID); assertTrue("Remove failed", iJtu.remove(iSession, tableName, aUid, entry)); iSession.rollbackTransaction(); iSession.close(); } catch (Throwable t) { iSession.rollbackTransaction(); iSession.close(); assertTrue("UnExp exp1: " + t.toString(), false); } }
public StorageAggregate update(final StorageView view) { removeAllItems(); long totalSize = 0; HashMap<String, Long> aggregateMap = new HashMap<String, Long>(); entryContainer.removeAllContainerFilters(); for (StorageEntry entry : entryContainer.getItemIds()) { String username = entry.getUsername(); if (!aggregateMap.containsKey(username)) { aggregateMap.put(username, entry.getSize()); } else { aggregateMap.put(username, aggregateMap.get(username) + entry.getSize()); } totalSize += entry.getSize(); } StorageAggregate totalBean = new StorageAggregate(); totalBean.setUsername(TOTAL_USERNAME); totalBean.setSize(totalSize); this.addBean(totalBean); for (Entry<String, Long> aggregate : aggregateMap.entrySet()) { StorageAggregate bean = new StorageAggregate(); bean.setUsername(aggregate.getKey()); bean.setSize(aggregate.getValue()); this.addBean(bean); } this.diskUsage = totalSize; this.diskAvailable = 500000000000l; return totalBean; }