ActivationKeyDTO extends TimestampedCandlepinDTO<ActivationKeyDTO> { @JsonIgnore public boolean addPool(ActivationKeyPoolDTO poolDto) { if (poolDto == null || poolDto.getPoolId() == null) { throw new IllegalArgumentException("poolDto is null or has null pool id."); } if (this.pools == null) { this.pools = new HashSet<>(); } return this.pools.add(poolDto); } ActivationKeyDTO();  ActivationKeyDTO(ActivationKeyDTO source); String getId(); ActivationKeyDTO setId(String id); String getName(); ActivationKeyDTO setName(String name); String getDescription(); ActivationKeyDTO setDescription(String description); OwnerDTO getOwner(); ActivationKeyDTO setOwner(OwnerDTO owner); @JsonSerialize(using = ReleaseVersionWrapSerializer.class, nullsUsing = ReleaseVersionWrapSerializer.class) @JsonProperty("releaseVer") String getReleaseVersion(); @JsonDeserialize(using = ReleaseVersionWrapDeserializer.class) @JsonProperty("releaseVer") ActivationKeyDTO setReleaseVersion(String releaseVersion); String getServiceLevel(); ActivationKeyDTO setServiceLevel(String serviceLevel); String getUsage(); ActivationKeyDTO setUsage(String usage); String getRole(); ActivationKeyDTO setRole(String role); SetView<String> getAddOns(); ActivationKeyDTO setAddOns(Set<String> addOns); Boolean isAutoAttach(); ActivationKeyDTO setAutoAttach(Boolean autoAttach); Set<ActivationKeyPoolDTO> getPools(); ActivationKeyDTO setPools(Collection<ActivationKeyPoolDTO> pools); @JsonIgnore boolean hasPool(String poolId); @JsonIgnore boolean removePool(String poolId); @JsonIgnore boolean addPool(ActivationKeyPoolDTO poolDto); @JsonSerialize(contentUsing = ProductWrapSerializer.class) @JsonProperty("products") Set<String> getProductIds(); @JsonDeserialize(contentUsing = ProductWrapDeserializer.class) @JsonProperty("products") ActivationKeyDTO setProductIds(Collection<String> productIds); @JsonIgnore boolean removeProductId(String productId); @JsonIgnore boolean hasProductId(String productId); @JsonIgnore boolean addProductId(String productId); Set<ContentOverrideDTO> getContentOverrides(); ActivationKeyDTO setContentOverrides(
        Collection<ContentOverrideDTO> contentOverrides); @JsonIgnore boolean removeContentOverride(ContentOverrideDTO contentOverrideDto); @JsonIgnore boolean addContentOverride(ContentOverrideDTO contentOverrideDto); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override ActivationKeyDTO clone(); @Override ActivationKeyDTO populate(ActivationKeyDTO source); static final long serialVersionUID; }
@Test public void testAddPoolWithAbsentPool() { ActivationKeyDTO dto = new ActivationKeyDTO(); ActivationKeyDTO.ActivationKeyPoolDTO akPool = new ActivationKeyDTO.ActivationKeyPoolDTO("test-id-pool-5", null); assertTrue(dto.addPool(akPool)); }
@Test public void testAddPoolWithPresentPool() { ActivationKeyDTO dto = new ActivationKeyDTO(); ActivationKeyDTO.ActivationKeyPoolDTO akPool = new ActivationKeyDTO.ActivationKeyPoolDTO("test-id-pool-6", null); assertTrue(dto.addPool(akPool)); ActivationKeyDTO.ActivationKeyPoolDTO akPool2 = new ActivationKeyDTO.ActivationKeyPoolDTO("test-id-pool-6", null); assertFalse(dto.addPool(akPool2)); }
@Test(expected = IllegalArgumentException.class) public void testAddPoolWithNullInput() { ActivationKeyDTO dto = new ActivationKeyDTO(); dto.addPool(null); }
@Test(expected = IllegalArgumentException.class) public void testAddPoolWithEmptyPoolId() { ActivationKeyDTO dto = new ActivationKeyDTO(); ActivationKeyDTO.ActivationKeyPoolDTO akPool = new ActivationKeyDTO.ActivationKeyPoolDTO("", null); assertTrue(dto.addPool(akPool)); }