use of org.apache.geode.management.internal.cli.domain.DiskStoreDetails in project geode by apache.
the class DiskStoreCommands method toCompositeResult.
protected Result toCompositeResult(final DiskStoreDetails diskStoreDetails) {
final CompositeResultData diskStoreData = ResultBuilder.createCompositeResultData();
final CompositeResultData.SectionResultData diskStoreSection = diskStoreData.addSection();
diskStoreSection.addData("Disk Store ID", diskStoreDetails.getId());
diskStoreSection.addData("Disk Store Name", diskStoreDetails.getName());
diskStoreSection.addData("Member ID", diskStoreDetails.getMemberId());
diskStoreSection.addData("Member Name", diskStoreDetails.getMemberName());
diskStoreSection.addData("Allow Force Compaction", toString(diskStoreDetails.isAllowForceCompaction(), "Yes", "No"));
diskStoreSection.addData("Auto Compaction", toString(diskStoreDetails.isAutoCompact(), "Yes", "No"));
diskStoreSection.addData("Compaction Threshold", diskStoreDetails.getCompactionThreshold());
diskStoreSection.addData("Max Oplog Size", diskStoreDetails.getMaxOplogSize());
diskStoreSection.addData("Queue Size", diskStoreDetails.getQueueSize());
diskStoreSection.addData("Time Interval", diskStoreDetails.getTimeInterval());
diskStoreSection.addData("Write Buffer Size", diskStoreDetails.getWriteBufferSize());
diskStoreSection.addData("Disk Usage Warning Percentage", diskStoreDetails.getDiskUsageWarningPercentage());
diskStoreSection.addData("Disk Usage Critical Percentage", diskStoreDetails.getDiskUsageCriticalPercentage());
diskStoreSection.addData("PDX Serialization Meta-Data Stored", toString(diskStoreDetails.isPdxSerializationMetaDataStored(), "Yes", "No"));
final TabularResultData diskDirTable = diskStoreData.addSection().addTable();
for (DiskStoreDetails.DiskDirDetails diskDirDetails : diskStoreDetails) {
diskDirTable.accumulate("Disk Directory", diskDirDetails.getAbsolutePath());
diskDirTable.accumulate("Size", diskDirDetails.getSize());
}
final TabularResultData regionTable = diskStoreData.addSection().addTable();
for (DiskStoreDetails.RegionDetails regionDetails : diskStoreDetails.iterateRegions()) {
regionTable.accumulate("Region Path", regionDetails.getFullPath());
regionTable.accumulate("Region Name", regionDetails.getName());
regionTable.accumulate("Persistent", toString(regionDetails.isPersistent(), "Yes", "No"));
regionTable.accumulate("Overflow To Disk", toString(regionDetails.isOverflowToDisk(), "Yes", "No"));
}
final TabularResultData cacheServerTable = diskStoreData.addSection().addTable();
for (DiskStoreDetails.CacheServerDetails cacheServerDetails : diskStoreDetails.iterateCacheServers()) {
cacheServerTable.accumulate("Bind Address", cacheServerDetails.getBindAddress());
cacheServerTable.accumulate("Hostname for Clients", cacheServerDetails.getHostName());
cacheServerTable.accumulate("Port", cacheServerDetails.getPort());
}
final TabularResultData gatewayTable = diskStoreData.addSection().addTable();
for (DiskStoreDetails.GatewayDetails gatewayDetails : diskStoreDetails.iterateGateways()) {
gatewayTable.accumulate("Gateway ID", gatewayDetails.getId());
gatewayTable.accumulate("Persistent", toString(gatewayDetails.isPersistent(), "Yes", "No"));
}
final TabularResultData asyncEventQueueTable = diskStoreData.addSection().addTable();
for (DiskStoreDetails.AsyncEventQueueDetails asyncEventQueueDetails : diskStoreDetails.iterateAsyncEventQueues()) {
asyncEventQueueTable.accumulate("Async Event Queue ID", asyncEventQueueDetails.getId());
}
return ResultBuilder.buildResult(diskStoreData);
}
use of org.apache.geode.management.internal.cli.domain.DiskStoreDetails in project geode by apache.
the class DiskStoreCommands method getDiskStoreListing.
@SuppressWarnings("unchecked")
protected List<DiskStoreDetails> getDiskStoreListing(Set<DistributedMember> members) {
final Execution membersFunctionExecutor = getMembersFunctionExecutor(members);
if (membersFunctionExecutor instanceof AbstractExecution) {
((AbstractExecution) membersFunctionExecutor).setIgnoreDepartedMembers(true);
}
final ResultCollector<?, ?> resultCollector = membersFunctionExecutor.execute(new ListDiskStoresFunction());
final List<?> results = (List<?>) resultCollector.getResult();
final List<DiskStoreDetails> distributedSystemMemberDiskStores = new ArrayList<DiskStoreDetails>(results.size());
for (final Object result : results) {
if (result instanceof Set) {
// ignore FunctionInvocationTargetExceptions and other
// Exceptions...
distributedSystemMemberDiskStores.addAll((Set<DiskStoreDetails>) result);
}
}
Collections.sort(distributedSystemMemberDiskStores);
return distributedSystemMemberDiskStores;
}
use of org.apache.geode.management.internal.cli.domain.DiskStoreDetails in project geode by apache.
the class DiskStoreCommands method toTabularResult.
protected Result toTabularResult(final List<DiskStoreDetails> diskStoreList) throws ResultDataException {
if (!diskStoreList.isEmpty()) {
final TabularResultData diskStoreData = ResultBuilder.createTabularResultData();
for (final DiskStoreDetails diskStoreDetails : diskStoreList) {
diskStoreData.accumulate("Member Name", diskStoreDetails.getMemberName());
diskStoreData.accumulate("Member Id", diskStoreDetails.getMemberId());
diskStoreData.accumulate("Disk Store Name", diskStoreDetails.getName());
diskStoreData.accumulate("Disk Store ID", diskStoreDetails.getId());
}
return ResultBuilder.buildResult(diskStoreData);
} else {
return ResultBuilder.createInfoResult(CliStrings.LIST_DISK_STORE__DISK_STORES_NOT_FOUND_MESSAGE);
}
}
use of org.apache.geode.management.internal.cli.domain.DiskStoreDetails in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testSetPdxSerializationDetailsWhenDiskStoreMismatch.
@Test
public void testSetPdxSerializationDetailsWhenDiskStoreMismatch() {
final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getPdxPersistent();
will(returnValue(true));
oneOf(mockCache).getPdxDiskStore();
will(returnValue("mockDiskStore"));
oneOf(mockDiskStore).getName();
will(returnValue("testDiskStore"));
}
});
final DiskStoreDetails diskStoreDetails = new DiskStoreDetails("testDiskStore", "memberOne");
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails);
assertFalse(diskStoreDetails.isPdxSerializationMetaDataStored());
}
use of org.apache.geode.management.internal.cli.domain.DiskStoreDetails in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testSetRegionDetails.
@Test
public void testSetRegionDetails() {
final String diskStoreName = "companyDiskStore";
final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
final Region mockCompanyRegion = mockContext.mock(Region.class, "/CompanyRegion");
final Region mockContractorsRegion = mockContext.mock(Region.class, "/CompanyRegion/ContractorsRegion");
final Region mockEmployeeRegion = mockContext.mock(Region.class, "/CompanyRegion/EmployeeRegion");
final Region mockRolesRegion = mockContext.mock(Region.class, "/CompanyRegion/EmployeeRegion/RolesRegion");
final Region mockProductsRegion = mockContext.mock(Region.class, "/CompanyRegion/ProductsRegion");
final Region mockServicesRegion = mockContext.mock(Region.class, "/CompanyRegion/ServicesRegion");
final Region mockPartnersRegion = mockContext.mock(Region.class, "/PartnersRegion");
final Region mockCustomersRegion = mockContext.mock(Region.class, "/CustomersRegion");
final RegionAttributes mockCompanyRegionAttributes = mockContext.mock(RegionAttributes.class, "CompanyRegionAttributes");
final RegionAttributes mockContractorsRegionAttributes = mockContext.mock(RegionAttributes.class, "ContractorsRegionAttributes");
final RegionAttributes mockProductsServicesRegionAttributes = mockContext.mock(RegionAttributes.class, "ProductsServicesRegionAttributes");
final RegionAttributes mockPartnersRegionAttributes = mockContext.mock(RegionAttributes.class, "PartnersRegionAttributes");
final RegionAttributes mockCustomersRegionAttributes = mockContext.mock(RegionAttributes.class, "CustomersRegionAttributes");
final EvictionAttributes mockCompanyEvictionAttributes = mockContext.mock(EvictionAttributes.class, "CompanyEvictionAttributes");
final EvictionAttributes mockContractorsEvictionAttributes = mockContext.mock(EvictionAttributes.class, "ContractorsEvictionAttributes");
final EvictionAttributes mockCustomersEvictionAttributes = mockContext.mock(EvictionAttributes.class, "CustomersEvictionAttributes");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).rootRegions();
will(returnValue(CollectionUtils.asSet(mockCompanyRegion, mockPartnersRegion, mockCustomersRegion)));
exactly(5).of(mockCompanyRegion).getAttributes();
will(returnValue(mockCompanyRegionAttributes));
oneOf(mockCompanyRegion).getFullPath();
will(returnValue("/CompanyRegion"));
oneOf(mockCompanyRegion).getName();
will(returnValue("CompanyRegion"));
oneOf(mockCompanyRegion).subregions(false);
will(returnValue(CollectionUtils.asSet(mockContractorsRegion, mockEmployeeRegion, mockProductsRegion, mockServicesRegion)));
exactly(5).of(mockEmployeeRegion).getAttributes();
will(returnValue(mockCompanyRegionAttributes));
oneOf(mockEmployeeRegion).getFullPath();
will(returnValue("/CompanyRegion/EmployeeRegion"));
oneOf(mockEmployeeRegion).getName();
will(returnValue("EmployeeRegion"));
oneOf(mockEmployeeRegion).subregions(false);
will(returnValue(CollectionUtils.asSet(mockRolesRegion)));
exactly(5).of(mockRolesRegion).getAttributes();
will(returnValue(mockCompanyRegionAttributes));
oneOf(mockRolesRegion).getFullPath();
will(returnValue("/CompanyRegion/EmployeeRegion/RolesRegion"));
oneOf(mockRolesRegion).getName();
will(returnValue("RolesRegion"));
oneOf(mockRolesRegion).subregions(false);
will(returnValue(Collections.emptySet()));
exactly(6).of(mockCompanyRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.PERSISTENT_PARTITION));
exactly(3).of(mockCompanyRegionAttributes).getDiskStoreName();
will(returnValue(diskStoreName));
exactly(6).of(mockCompanyRegionAttributes).getEvictionAttributes();
will(returnValue(mockCompanyEvictionAttributes));
exactly(3).of(mockCompanyEvictionAttributes).getAction();
will(returnValue(EvictionAction.LOCAL_DESTROY));
exactly(7).of(mockContractorsRegion).getAttributes();
will(returnValue(mockContractorsRegionAttributes));
oneOf(mockContractorsRegion).getFullPath();
will(returnValue("/CompanyRegion/ContractorsRegion"));
oneOf(mockContractorsRegion).getName();
will(returnValue("ContractorsRegion"));
oneOf(mockContractorsRegion).subregions(false);
will(returnValue(Collections.emptySet()));
exactly(2).of(mockContractorsRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.REPLICATE));
oneOf(mockContractorsRegionAttributes).getDiskStoreName();
will(returnValue(diskStoreName));
exactly(4).of(mockContractorsRegionAttributes).getEvictionAttributes();
will(returnValue(mockContractorsEvictionAttributes));
exactly(2).of(mockContractorsEvictionAttributes).getAction();
will(returnValue(EvictionAction.OVERFLOW_TO_DISK));
exactly(2).of(mockProductsRegion).getAttributes();
will(returnValue(mockProductsServicesRegionAttributes));
oneOf(mockProductsRegion).subregions(false);
will(returnValue(Collections.emptySet()));
exactly(2).of(mockServicesRegion).getAttributes();
will(returnValue(mockProductsServicesRegionAttributes));
oneOf(mockServicesRegion).subregions(false);
will(returnValue(Collections.emptySet()));
exactly(2).of(mockProductsServicesRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.PERSISTENT_REPLICATE));
exactly(2).of(mockProductsServicesRegionAttributes).getDiskStoreName();
will(returnValue("productsServicesDiskStore"));
exactly(2).of(mockPartnersRegion).getAttributes();
will(returnValue(mockPartnersRegionAttributes));
oneOf(mockPartnersRegion).subregions(false);
will(returnValue(Collections.emptySet()));
oneOf(mockPartnersRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.PERSISTENT_PARTITION));
oneOf(mockPartnersRegionAttributes).getDiskStoreName();
will(returnValue(""));
exactly(4).of(mockCustomersRegion).getAttributes();
will(returnValue(mockCustomersRegionAttributes));
oneOf(mockCustomersRegion).subregions(false);
will(returnValue(Collections.emptySet()));
oneOf(mockCustomersRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.REPLICATE));
oneOf(mockCustomersRegionAttributes).getDiskStoreName();
will(returnValue(null));
exactly(2).of(mockCustomersRegionAttributes).getEvictionAttributes();
will(returnValue(mockCustomersEvictionAttributes));
oneOf(mockCustomersEvictionAttributes).getAction();
will(returnValue(EvictionAction.OVERFLOW_TO_DISK));
atLeast(1).of(mockDiskStore).getName();
will(returnValue(diskStoreName));
}
});
final Set<DiskStoreDetails.RegionDetails> expectedRegionDetails = CollectionUtils.asSet(createRegionDetails("/CompanyRegion", "CompanyRegion", true, false), createRegionDetails("/CompanyRegion/EmployeeRegion", "EmployeeRegion", true, false), createRegionDetails("/CompanyRegion/EmployeeRegion/RolesRegion", "RolesRegion", true, false), createRegionDetails("/CompanyRegion/ContractorsRegion", "ContractorsRegion", false, true));
final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
function.setRegionDetails(mockCache, mockDiskStore, diskStoreDetails);
assertRegionDetails(expectedRegionDetails, diskStoreDetails);
}
Aggregations