@Before public void setup() { _context = new ClassPathXmlApplicationContext("metering-vnxfile-context.xml"); try { ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("/dbutils-conf.xml"); _dbClient = (DbClientImpl) ctx.getBean("dbclient"); _dbClient = Cassandraforplugin.returnDBClient(); final TenantOrg tenantorg = new TenantOrg(); tenantorg.setId(URIUtil.createId(TenantOrg.class)); tenantorg.setLabel("some org"); tenantorg.setParentTenant( new NamedURI(URIUtil.createId(TenantOrg.class), tenantorg.getLabel())); _logger.info("TenantOrg :" + tenantorg.getId()); _dbClient.persistObject(tenantorg); final Project proj = new Project(); proj.setId(URIUtil.createId(Project.class)); proj.setLabel("some name"); proj.setTenantOrg(new NamedURI(tenantorg.getId(), proj.getLabel())); _logger.info("Project :" + proj.getId()); _logger.info("TenantOrg-Proj :" + proj.getTenantOrg()); _dbClient.persistObject(proj); final FileShare fileShare = new FileShare(); fileShare.setId(URIUtil.createId(FileShare.class)); fileShare.setLabel("some fileshare"); fileShare.setNativeGuid("CELERRA+" + serialNumber); fileShare.setVirtualPool(URIUtil.createId(VirtualPool.class)); fileShare.setProject(new NamedURI(proj.getId(), fileShare.getLabel())); fileShare.setCapacity(12500L); _dbClient.persistObject(fileShare); } catch (final Exception ioEx) { _logger.error("Exception occurred while persisting objects in db {}", ioEx.getMessage()); _logger.error(ioEx.getMessage(), ioEx); } }
/** Test case to collect statistics for VNX File. */ @Test public void testVNXFileDataCollection() { try { _logger.debug("Executing testVNXFileDataCollection() test case."); final VNXFileCommunicationInterface plugin = (VNXFileCommunicationInterface) _context.getBean("vnxfile"); plugin.injectCache(new ConcurrentHashMap<String, Object>()); plugin.injectDBClient(_dbClient); plugin.collectStatisticsInformation(createAccessProfile()); long latchcount = Cassandraforplugin.query(_dbClient); Assert.assertTrue("Processed 0 record", latchcount == 0); plugin.cleanup(); } catch (Exception e) { _logger.error(e.getMessage(), e); } _logger.debug("Executing testVNXFileDataCollection() test case completed."); }