@Override protected LibvirtSecret getEntity(int index) { LibvirtSecret libvirtSecret = mock(LibvirtSecret.class); when(libvirtSecret.getId()).thenReturn(GUIDS[index]); when(libvirtSecret.getDescription()).thenReturn(DESCRIPTIONS[index]); when(libvirtSecret.getProviderId()).thenReturn(GUIDS[0]); when(libvirtSecret.getUsageType()).thenReturn(LibvirtSecretUsageType.CEPH); return libvirtSecret; }
@Override protected LibvirtSecret getEntity(int index) { LibvirtSecret libvirtSecret = mock(LibvirtSecret.class); when(libvirtSecret.getId()).thenReturn(GUIDS[index]); when(libvirtSecret.getDescription()).thenReturn(DESCRIPTIONS[index]); when(libvirtSecret.getProviderId()).thenReturn(GUIDS[0]); when(libvirtSecret.getUsageType()).thenReturn(LibvirtSecretUsageType.CEPH); return libvirtSecret; }
@Override protected MapSqlParameterSource createFullParametersMapper(LibvirtSecret entity) { return createIdParameterMapper(entity.getId()) .addValue("secret_value", DbFacadeUtils.encryptPassword(entity.getValue())) .addValue("secret_usage_type", entity.getUsageType()) .addValue("secret_description", entity.getDescription()) .addValue("provider_id", entity.getProviderId()) .addValue("_create_date", entity.getCreationDate()); }
@Mapping(from = LibvirtSecret.class, to = OpenstackVolumeAuthenticationKey.class) public static OpenstackVolumeAuthenticationKey map(LibvirtSecret entity, OpenstackVolumeAuthenticationKey template) { OpenstackVolumeAuthenticationKey model = template != null ? template : new OpenstackVolumeAuthenticationKey(); if (entity.getId() != null) { model.setId(entity.getId().toString()); model.setUuid(entity.getId().toString()); } if (entity.getDescription() != null) { model.setDescription(entity.getDescription()); } if (entity.getCreationDate() != null) { model.setCreationDate(DateMapper.map(entity.getCreationDate(), null)); } if (entity.getUsageType() != null) { model.setUsageType(map(entity.getUsageType(), null)); } if (entity.getProviderId() != null) { OpenStackVolumeProvider provider = new OpenStackVolumeProvider(); provider.setId(entity.getProviderId().toString()); model.setOpenstackVolumeProvider(provider); } return model; }