Package com.vmware.bdd.apitypes

Examples of com.vmware.bdd.apitypes.DatastoreRead


      List<VcDatastoreEntity> entities = dsDao.findByName(name);
      if (entities.isEmpty()) {
         return null;
      }

      DatastoreRead read = new DatastoreRead();
      read.setName(name);
      read.setType(entities.get(0).getType());
      read.setRegexByBoolean(entities.get(0).getRegex());
      read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
      for (VcDatastoreEntity entity : entities) {
         DatastoreReadDetail detail = new DatastoreReadDetail();
         detail.setVcDatastoreName(entity.getVcDatastore());
         read.getDatastoreReadDetails().add(detail);
      }
      logger.debug("found datastore: " + read);
      return read;
   }
View Full Code Here


      List<DatastoreRead> result = new ArrayList<DatastoreRead>();
      if (entities.isEmpty()) {
         return result;
      }

      DatastoreRead read = new DatastoreRead();
      read.setName(entities.get(0).getName());
      read.setType(entities.get(0).getType());
      read.setRegexByBoolean(entities.get(0).getRegex());
      read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
      result.add(read);
      for (VcDatastoreEntity entity : entities) {
         if (!entity.getName().equals(read.getName())) {
            // new datastore
            read = new DatastoreRead();
            read.setName(entity.getName());
            read.setType(entity.getType());
            read.setRegexByBoolean(entity.getRegex());
            read.setDatastoreReadDetails(new ArrayList<DatastoreReadDetail>());
            result.add(read);
         }
         DatastoreReadDetail detail = new DatastoreReadDetail();
         detail.setVcDatastoreName(entity.getVcDatastore());
         read.getDatastoreReadDetails().add(detail);
      }
      logger.debug("found datastores: " + result);
      return result;
   }
View Full Code Here

      dsName = CommonUtil.decode(dsName);
      if (CommonUtil.isBlank(dsName)
            || !CommonUtil.validateResourceName(dsName)) {
         throw BddException.INVALID_PARAMETER("datestore name", dsName);
      }
      DatastoreRead read = datastoreSvc.getDatastoreRead(dsName);
      if (read == null) {
         throw BddException.NOT_FOUND("Data store", dsName);
      }
      return read;
   }
View Full Code Here

            DatastoreRead[] datastores = restClient.getAll();
            if (datastores != null) {
               prettyOutputDatastoresInfo(datastores, detail);
            }
         } else {
            DatastoreRead datastore = restClient.get(name);
            if (datastore != null) {
               prettyOutputDatastoreInfo(datastore, detail);
            }
         }
      } catch (CliRestException e) {
View Full Code Here

   }

   @Test
   public void testListDatastore() throws Exception {
      CookieCache.put("Cookie","JSESSIONID=2AAF431F59ACEE1CC68B43C87772C54F");
      DatastoreRead rd1 = new DatastoreRead();
      rd1.setName("rd1Name");
      rd1.setType(DatastoreType.LOCAL);
      rd1.setTotalSpaceGB(100.32);
      rd1.setFreeSpaceGB(50.00);
      List<DatastoreReadDetail> datastoreReadDetails1 =
            new ArrayList<DatastoreReadDetail>();
      DatastoreReadDetail dr1Detail1 = new DatastoreReadDetail();
      dr1Detail1.setVcDatastoreName("vcds1");
      dr1Detail1.setHost("10.1.1.1");
      dr1Detail1.setTotalStorageSizeGB(90.32);
      dr1Detail1.setFreeSpaceGB(45.00);
      DatastoreReadDetail dr1Detail2 = new DatastoreReadDetail();
      dr1Detail2.setVcDatastoreName("vcds2");
      dr1Detail2.setHost("10.1.1.2");
      dr1Detail2.setTotalStorageSizeGB(10.00);
      dr1Detail2.setFreeSpaceGB(5.00);
      datastoreReadDetails1.add(dr1Detail1);
      datastoreReadDetails1.add(dr1Detail2);
      rd1.setDatastoreReadDetails(datastoreReadDetails1);

      DatastoreRead rd2 = new DatastoreRead();
      rd2.setName("rd2Name");
      rd2.setType(DatastoreType.SHARED);
      rd2.setTotalSpaceGB(20.00);
      rd2.setFreeSpaceGB(15.00);
      List<DatastoreReadDetail> datastoreReadDetails2 =
            new ArrayList<DatastoreReadDetail>();
      DatastoreReadDetail dr2Detail1 = new DatastoreReadDetail();
      dr2Detail1.setVcDatastoreName("vcds2");
      dr2Detail1.setHost("10.1.1.3");
      dr2Detail1.setTotalStorageSizeGB(20.00);
      dr2Detail1.setFreeSpaceGB(15.00);
      datastoreReadDetails2.add(dr2Detail1);
      rd2.setDatastoreReadDetails(datastoreReadDetails2);

      ObjectMapper mapper = new ObjectMapper();
      testListDatastore(mapper, new DatastoreRead[] { rd1, rd2 });
      CookieCache.clear();
   }
View Full Code Here

            dsDao.findByName(anyString);
            result = dss;
         }
      };
      datastoreSvc.setDsDao(dsDao);
      DatastoreRead ds = datastoreSvc.getDatastoreRead("testDS");
      Assert.assertNotNull(ds);
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.apitypes.DatastoreRead

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.