コード例 #1
0
  /**
   * Create a tar.gz archive of the exported directory.
   *
   * @param exportDir Directory where Candlepin data was exported.
   * @return File reference to the new archive zip.
   */
  private File makeArchive(Consumer consumer, File tempDir, File exportDir) throws IOException {
    String exportFileName = exportDir.getName() + ".zip";
    log.info("Creating archive of " + exportDir.getAbsolutePath() + " in: " + exportFileName);

    File archive =
        createZipArchiveWithDir(
            tempDir,
            exportDir,
            "consumer_export.zip",
            "Candlepin export for " + consumer.getUuid());

    InputStream archiveInputStream = null;
    try {
      archiveInputStream = new FileInputStream(archive);
      File signedArchive =
          createSignedZipArchive(
              tempDir,
              archive,
              exportFileName,
              pki.getSHA256WithRSAHash(archiveInputStream),
              "signed Candlepin export for " + consumer.getUuid());

      log.debug("Returning file: " + archive.getAbsolutePath());
      return signedArchive;
    } finally {
      if (archiveInputStream != null) {
        try {
          archiveInputStream.close();
        } catch (Exception e) {
          // nothing to do
        }
      }
    }
  }
コード例 #2
0
  @Test
  public void testGetComplianceStatusList() {
    Consumer c = mock(Consumer.class);
    Consumer c2 = mock(Consumer.class);
    when(c.getUuid()).thenReturn("1");
    when(c2.getUuid()).thenReturn("2");

    List<Consumer> consumers = new ArrayList<Consumer>();
    consumers.add(c);
    consumers.add(c2);

    List<String> uuids = new ArrayList<String>();
    uuids.add("1");
    uuids.add("2");
    when(mockedConsumerCurator.findByUuids(eq(uuids))).thenReturn(consumers);

    ComplianceStatus status = new ComplianceStatus();
    when(mockedComplianceRules.getStatus(any(Consumer.class), any(Date.class))).thenReturn(status);

    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            i18n,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            mockedComplianceRules,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);

    Map<String, ComplianceStatus> results = cr.getComplianceStatusList(uuids);
    assertEquals(2, results.size());
    assertTrue(results.containsKey("1"));
    assertTrue(results.containsKey("2"));
  }
コード例 #3
0
  @Test
  public void testRegenerateIdCerts() throws GeneralSecurityException, IOException {

    // using lconsumer simply to avoid hiding consumer. This should
    // get renamed once we refactor this test suite.
    IdentityCertServiceAdapter mockedIdSvc = Mockito.mock(IdentityCertServiceAdapter.class);

    EventSink sink = Mockito.mock(EventSinkImpl.class);

    Consumer consumer = createConsumer();
    consumer.setIdCert(createIdCert());
    IdentityCertificate ic = consumer.getIdCert();
    assertNotNull(ic);

    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);
    when(mockedIdSvc.regenerateIdentityCert(consumer)).thenReturn(createIdCert());

    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            null,
            mockedIdSvc,
            null,
            null,
            sink,
            eventFactory,
            null,
            null,
            null,
            null,
            null,
            mockedOwnerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);

    Consumer fooc = cr.regenerateIdentityCertificates(consumer.getUuid());

    assertNotNull(fooc);
    IdentityCertificate ic1 = fooc.getIdCert();
    assertNotNull(ic1);
    assertFalse(ic.equals(ic1));
  }
コード例 #4
0
  @Test
  public void testIdCertGetsRegenerated() throws Exception {
    // using lconsumer simply to avoid hiding consumer. This should
    // get renamed once we refactor this test suite.
    IdentityCertServiceAdapter mockedIdSvc = Mockito.mock(IdentityCertServiceAdapter.class);

    EventSink sink = Mockito.mock(EventSinkImpl.class);

    SubscriptionServiceAdapter ssa = Mockito.mock(SubscriptionServiceAdapter.class);
    ComplianceRules rules = Mockito.mock(ComplianceRules.class);

    Consumer consumer = createConsumer();
    ComplianceStatus status = new ComplianceStatus();
    when(rules.getStatus(any(Consumer.class), any(Date.class), anyBoolean())).thenReturn(status);
    // cert expires today which will trigger regen
    consumer.setIdCert(createIdCert());
    BigInteger origserial = consumer.getIdCert().getSerial().getSerial();

    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);
    when(mockedIdSvc.regenerateIdentityCert(consumer)).thenReturn(createIdCert());

    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            ssa,
            null,
            mockedIdSvc,
            null,
            null,
            sink,
            eventFactory,
            null,
            null,
            null,
            null,
            null,
            mockedOwnerCurator,
            null,
            null,
            rules,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);
    Consumer c = cr.getConsumer(consumer.getUuid());

    assertFalse(origserial.equals(c.getIdCert().getSerial().getSerial()));
  }
コード例 #5
0
ファイル: EntitlerTest.java プロジェクト: candlepin/candlepin
 @Test(expected = BadRequestException.class)
 public void nullPool() throws EntitlementRefusedException {
   String poolid = "foo";
   Consumer c = TestUtil.createConsumer(); // keeps me from casting null
   Map<String, Integer> pQs = new HashMap<String, Integer>();
   pQs.put(poolid, 1);
   when(cc.findByUuid(eq(c.getUuid()))).thenReturn(c);
   when(pm.entitleByPools(eq(c), eq(pQs))).thenThrow(new IllegalArgumentException());
   entitler.bindByPoolQuantities(c.getUuid(), pQs);
 }
コード例 #6
0
  @Test
  public void testAsyncExport() {
    CdnCurator mockedCdnCurator = mock(CdnCurator.class);
    ManifestManager manifestManager = mock(ManifestManager.class);
    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            i18n,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            mockedOwnerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            mockedCdnCurator,
            null,
            null,
            productCurator,
            manifestManager);

    List<KeyValueParameter> extParams = new ArrayList<KeyValueParameter>();
    Owner owner = TestUtil.createOwner();
    Consumer consumer =
        TestUtil.createConsumer(new ConsumerType(ConsumerType.ConsumerTypeEnum.CANDLEPIN), owner);
    Cdn cdn = new Cdn("cdn-label", "test", "url");

    when(mockedConsumerCurator.verifyAndLookupConsumer(eq(consumer.getUuid())))
        .thenReturn(consumer);
    when(mockedCdnCurator.lookupByLabel(eq(cdn.getLabel()))).thenReturn(cdn);

    cr.exportDataAsync(null, consumer.getUuid(), cdn.getLabel(), "prefix", cdn.getUrl(), extParams);
    verify(manifestManager)
        .generateManifestAsync(
            eq(consumer.getUuid()),
            eq(cdn.getLabel()),
            eq("prefix"),
            eq(cdn.getUrl()),
            any(Map.class));
  }
コード例 #7
0
  @Test
  public void testIdCertDoesNotRegenerate() throws Exception {
    SubscriptionServiceAdapter ssa = Mockito.mock(SubscriptionServiceAdapter.class);
    ComplianceRules rules = Mockito.mock(ComplianceRules.class);

    Consumer consumer = createConsumer();
    ComplianceStatus status = new ComplianceStatus();
    when(rules.getStatus(any(Consumer.class), any(Date.class), anyBoolean())).thenReturn(status);
    consumer.setIdCert(createIdCert(TestUtil.createDate(2025, 6, 9)));
    BigInteger origserial = consumer.getIdCert().getSerial().getSerial();

    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);

    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            ssa,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            mockedOwnerCurator,
            null,
            null,
            rules,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);

    Consumer c = cr.getConsumer(consumer.getUuid());

    assertEquals(origserial, c.getIdCert().getSerial().getSerial());
  }
コード例 #8
0
  @Test
  public void hypervisorCheckInUpdatesGuestIdsWhenHostConsumerExists() throws Exception {
    Owner owner = new Owner("admin");

    Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>();
    hostGuestMap.put("test-host", Arrays.asList(new GuestId("GUEST_B")));

    Owner o = new Owner();
    o.setId("owner-id");
    Consumer existing = new Consumer();
    existing.setUuid("test-host");
    existing.setOwner(o);
    existing.addGuestId(new GuestId("GUEST_A"));

    when(consumerCurator.findByUuid(eq("test-host"))).thenReturn(existing);

    HypervisorCheckInResult result =
        hypervisorResource.hypervisorCheckIn(hostGuestMap, principal, owner.getKey());
    Set<Consumer> updated = result.getUpdated();
    assertEquals(1, updated.size());

    Consumer c1 = updated.iterator().next();
    assertEquals("test-host", c1.getUuid());
    assertEquals(1, c1.getGuestIds().size());
    assertEquals("GUEST_B", c1.getGuestIds().get(0).getGuestId());
  }
コード例 #9
0
  @Test
  public void hypervisorCheckInCreatesNewConsumer() throws Exception {
    Owner owner = new Owner("admin");

    Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>();
    hostGuestMap.put("test-host", Arrays.asList(new GuestId("GUEST_A"), new GuestId("GUEST_B")));

    when(consumerCurator.findByUuid(eq("test-host"))).thenReturn(null);
    when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner);
    when(principal.canAccess(eq(owner), eq(Access.ALL))).thenReturn(true);
    when(consumerTypeCurator.lookupByLabel(eq(ConsumerTypeEnum.HYPERVISOR.getLabel())))
        .thenReturn(hypervisorType);
    when(idCertService.generateIdentityCert(any(Consumer.class)))
        .thenReturn(new IdentityCertificate());

    HypervisorCheckInResult result =
        hypervisorResource.hypervisorCheckIn(hostGuestMap, principal, owner.getKey());

    Set<Consumer> created = result.getCreated();
    assertEquals(1, created.size());

    Consumer c1 = created.iterator().next();
    assertEquals("test-host", c1.getUuid());
    assertEquals(2, c1.getGuestIds().size());
    assertEquals("GUEST_A", c1.getGuestIds().get(0).getGuestId());
    assertEquals("GUEST_B", c1.getGuestIds().get(1).getGuestId());
    assertEquals("x86_64", c1.getFact("uname.machine"));
    assertEquals("hypervisor", c1.getType().getLabel());
  }
コード例 #10
0
ファイル: EntitlerTest.java プロジェクト: candlepin/candlepin
  @Test
  public void testCreatedDevPoolAttributes() {
    Owner owner = TestUtil.createOwner("o");
    List<ProductData> devProdDTOs = new ArrayList<ProductData>();
    Product p1 = TestUtil.createProduct("dev-product", "Dev Product");
    p1.setAttribute("support_level", "Premium");
    p1.setAttribute("expires_after", "47");
    Product p2 = TestUtil.createProduct("provided-product1", "Provided Product 1");
    Product p3 = TestUtil.createProduct("provided-product2", "Provided Product 2");
    devProdDTOs.add(p1.toDTO());
    devProdDTOs.add(p2.toDTO());
    devProdDTOs.add(p3.toDTO());
    Consumer devSystem = TestUtil.createConsumer(owner);
    devSystem.setFact("dev_sku", p1.getId());
    devSystem.addInstalledProduct(new ConsumerInstalledProduct(p2));
    devSystem.addInstalledProduct(new ConsumerInstalledProduct(p3));
    when(productAdapter.getProductsByIds(eq(owner), any(List.class))).thenReturn(devProdDTOs);

    this.mockProducts(owner, p1, p2, p3);
    this.mockProductImport(owner, p1, p2, p3);
    this.mockContentImport(owner, Collections.<String, Content>emptyMap());

    Pool created = entitler.assembleDevPool(devSystem, devSystem.getFact("dev_sku"));
    Calendar cal = Calendar.getInstance();
    cal.setTime(created.getStartDate());
    cal.add(Calendar.DAY_OF_YEAR, 47);
    assertEquals(created.getEndDate(), cal.getTime());
    assertEquals("true", created.getAttributeValue(Pool.Attributes.DEVELOPMENT_POOL));
    assertEquals(devSystem.getUuid(), created.getAttributeValue(Pool.Attributes.REQUIRES_CONSUMER));
    assertEquals(p1.getId(), created.getProductId());
    assertEquals(2, created.getProvidedProducts().size());
    assertEquals("Premium", created.getProduct().getAttributeValue("support_level"));
    assertEquals(1L, created.getQuantity().longValue());
  }
コード例 #11
0
  @Test
  public void testGetCertSerials() {
    Consumer consumer = createConsumer();
    List<EntitlementCertificate> certificates = createEntitlementCertificates();

    when(mockedEntitlementCertServiceAdapter.listForConsumer(consumer)).thenReturn(certificates);
    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);
    when(mockedEntitlementCurator.listByConsumer(consumer))
        .thenReturn(new ArrayList<Entitlement>());

    ConsumerResource consumerResource =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            mockedEntitlementCurator,
            null,
            mockedEntitlementCertServiceAdapter,
            null,
            null,
            null,
            null,
            null,
            null,
            mockedPoolManager,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);

    List<CertificateSerialDto> serials =
        consumerResource.getEntitlementCertificateSerials(consumer.getUuid());

    verifyCertificateSerialNumbers(serials);
  }
コード例 #12
0
ファイル: ExporterTest.java プロジェクト: Ceiu/candlepin
  @Test
  public void exportConsumer() throws ExportCreationException, IOException {
    config.setProperty(ConfigProperties.SYNC_WORK_DIR, "/tmp/");
    config.setProperty(ConfigProperties.PREFIX_WEBURL, "localhost:8443/weburl");
    config.setProperty(ConfigProperties.PREFIX_APIURL, "localhost:8443/apiurl");
    Rules mrules = mock(Rules.class);
    Consumer consumer = mock(Consumer.class);
    Principal principal = mock(Principal.class);

    when(mrules.getRules()).thenReturn("foobar");
    when(pki.getSHA256WithRSAHash(any(InputStream.class))).thenReturn("signature".getBytes());
    when(rc.getRules()).thenReturn(mrules);
    when(pprov.get()).thenReturn(principal);
    when(principal.getUsername()).thenReturn("testUser");

    // specific to this test
    IdentityCertificate idcert = new IdentityCertificate();
    idcert.setSerial(new CertificateSerial(10L, new Date()));
    idcert.setKey("euh0876puhapodifbvj094");
    idcert.setCert("hpj-08ha-w4gpoknpon*)&^%#");
    idcert.setCreated(new Date());
    idcert.setUpdated(new Date());
    when(consumer.getIdCert()).thenReturn(idcert);

    KeyPair keyPair = createKeyPair();
    when(consumer.getKeyPair()).thenReturn(keyPair);
    when(pki.getPemEncoded(keyPair.getPrivateKey())).thenReturn("privateKey".getBytes());
    when(pki.getPemEncoded(keyPair.getPublicKey())).thenReturn("publicKey".getBytes());
    when(consumer.getUuid()).thenReturn("8auuid");
    when(consumer.getName()).thenReturn("consumer_name");
    when(consumer.getType()).thenReturn(new ConsumerType(ConsumerTypeEnum.CANDLEPIN));

    // FINALLY test this badboy
    Exporter e =
        new Exporter(
            ctc,
            me,
            ce,
            cte,
            re,
            ece,
            ecsa,
            pe,
            psa,
            pce,
            ec,
            ee,
            pki,
            config,
            exportRules,
            pprov,
            dvc,
            dve,
            cdnc,
            cdne);
    File export = e.getFullExport(consumer);

    verifyContent(export, "export/consumer.json", new VerifyConsumer("consumer.json"));
  }
コード例 #13
0
  @Test
  public void testNoDryBindWhenAutobindDisabledForOwner() throws Exception {
    Consumer consumer = createConsumer();
    consumer.getOwner().setAutobindDisabled(true);
    when(mockedConsumerCurator.verifyAndLookupConsumer(eq(consumer.getUuid())))
        .thenReturn(consumer);
    ManifestManager manifestManager = mock(ManifestManager.class);
    ConsumerResource consumerResource =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            i18n,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            mockedOwnerCurator,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            null,
            productCurator,
            manifestManager);

    try {
      consumerResource.dryBind(consumer.getUuid(), "some-sla");
      fail("Should have thrown a BadRequestException.");
    } catch (BadRequestException e) {
      assertEquals("Owner has autobind disabled.", e.getMessage());
    }
  }
コード例 #14
0
  /**
   * Test just verifies that entitler is called only once and it doesn't need any other object to
   * execute.
   */
  @Test
  public void testRegenerateEntitlementCertificateWithValidConsumer() {
    Consumer consumer = createConsumer();

    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);

    CandlepinPoolManager mgr = mock(CandlepinPoolManager.class);
    ConsumerResource cr =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            mockedSubscriptionServiceAdapter,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            mgr,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);
    cr.regenerateEntitlementCertificates(consumer.getUuid(), null, true);
    Mockito.verify(mgr, Mockito.times(1)).regenerateCertificatesOf(eq(consumer), eq(true));
  }
コード例 #15
0
ファイル: ExportJob.java プロジェクト: candlepin/candlepin
  /**
   * Schedules the generation of a consumer export. This job starts immediately.
   *
   * @param consumer the target consumer
   * @param cdnLabel
   * @param webAppPrefix
   * @param apiUrl
   * @return a JobDetail representing the job to be started.
   */
  public static JobDetail scheduleExport(
      Consumer consumer,
      String cdnLabel,
      String webAppPrefix,
      String apiUrl,
      Map<String, String> extensionData) {
    JobDataMap map = new JobDataMap();
    map.put(JobStatus.OWNER_ID, consumer.getOwner().getKey());
    map.put(JobStatus.TARGET_TYPE, JobStatus.TargetType.CONSUMER);
    map.put(JobStatus.TARGET_ID, consumer.getUuid());
    map.put(CDN_LABEL, cdnLabel);
    map.put(WEBAPP_PREFIX, webAppPrefix);
    map.put(API_URL, apiUrl);
    map.put(EXTENSION_DATA, extensionData);

    return newJob(ExportJob.class)
        .withIdentity("export_" + Util.generateUUID())
        .usingJobData(map)
        .build();
  }
コード例 #16
0
  @Test(expected = RuntimeException.class)
  public void testExceptionFromCertGen() throws Exception {
    Consumer consumer = createConsumer();

    Entitlement e = Mockito.mock(Entitlement.class);
    Pool p = Mockito.mock(Pool.class);
    Subscription s = Mockito.mock(Subscription.class);
    when(e.getPool()).thenReturn(p);
    when(p.getSubscriptionId()).thenReturn("4444");

    when(mockedConsumerCurator.verifyAndLookupConsumer(consumer.getUuid())).thenReturn(consumer);
    when(mockedEntitlementCurator.find(eq("9999"))).thenReturn(e);
    when(mockedSubscriptionServiceAdapter.getSubscription(eq("4444"))).thenReturn(s);

    when(mockedEntitlementCertServiceAdapter.generateEntitlementCert(
            any(Entitlement.class), any(Product.class)))
        .thenThrow(new IOException());

    CandlepinPoolManager poolManager =
        new CandlepinPoolManager(
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            mockedEntitlementCurator,
            mockedConsumerCurator,
            null,
            null,
            null,
            null,
            mockedActivationKeyRules,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null);

    ConsumerResource consumerResource =
        new ConsumerResource(
            mockedConsumerCurator,
            null,
            null,
            null,
            mockedEntitlementCurator,
            null,
            mockedEntitlementCertServiceAdapter,
            null,
            null,
            null,
            null,
            null,
            null,
            poolManager,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            new CandlepinCommonTestConfig(),
            null,
            null,
            null,
            consumerBindUtil,
            productCurator,
            null);

    consumerResource.regenerateEntitlementCertificates(consumer.getUuid(), "9999", false);
  }
コード例 #17
0
  @Test
  public void testcheckForGuestsMigration() {
    ConsumerResource cr =
        Mockito.spy(
            new ConsumerResource(
                mockedConsumerCurator,
                null,
                null,
                null,
                null,
                null,
                null,
                i18n,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                null,
                new CandlepinCommonTestConfig(),
                null,
                null,
                null,
                null,
                productCurator,
                null));
    List<GuestId> startGuests = new ArrayList<GuestId>();
    List<GuestId> updatedGuests = new ArrayList<GuestId>();
    VirtConsumerMap guestConsumerMap = new VirtConsumerMap();
    Owner o = mock(Owner.class);
    Consumer host = new Consumer();

    Consumer cOne = new Consumer();
    cOne.setFact("virt.is_guest", "true");
    cOne.setFact("virt.uuid", cOne.getUuid() + "-vuuid");
    cOne.setOwner(o);
    GuestId one = new GuestId(cOne.getFact("virt.uuid"));
    startGuests.add(one);
    guestConsumerMap.add(cOne.getFact("virt.uuid"), cOne);

    Consumer cTwo = new Consumer();
    cTwo.setFact("virt.is_guest", "true");
    cTwo.setFact("virt.uuid", cTwo.getUuid() + "-vuuid");
    cTwo.setOwner(o);
    GuestId two = new GuestId(cTwo.getFact("virt.uuid"));
    startGuests.add(two);
    updatedGuests.add(two);
    guestConsumerMap.add(cTwo.getFact("virt.uuid"), cTwo);

    Consumer cThree = new Consumer();
    cThree.setFact("virt.is_guest", "true");
    cThree.setFact("virt.uuid", cThree.getUuid() + "-vuuid");
    cThree.setOwner(o);
    GuestId three = new GuestId(cThree.getFact("virt.uuid"));
    updatedGuests.add(three);
    guestConsumerMap.add(cThree.getFact("virt.uuid"), cThree);

    cr.checkForGuestsMigration(host, startGuests, updatedGuests, guestConsumerMap);
    verify(cr).checkForGuestMigration(host, cOne);
    verify(cr).checkForGuestMigration(host, cTwo);
    verify(cr).checkForGuestMigration(host, cThree);
  }
コード例 #18
0
 @Override
 public boolean canAccessTarget(Entitlement target, SubResource subResource, Access required) {
   return target.getConsumer().getUuid().equals(consumer.getUuid());
 }