Search in sources :

Example 1 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultProvisioningExecutorIntegrationTest method testFillProvisioningAttributes.

@Test
public void testFillProvisioningAttributes() {
    SysSystemDto system = getHelper().createTestResourceSystem(true);
    system.setReadonly(true);
    system = systemService.save(system);
    SysProvisioningOperationDto provisioningOperation = createProvisioningOperation(system, getHelper().createName());
    // publish event
    provisioningExecutor.execute(provisioningOperation);
    // 
    SysProvisioningOperationFilter filter = new SysProvisioningOperationFilter();
    filter.setSystemEntity(provisioningOperation.getSystemEntity());
    filter.setSystemId(system.getId());
    filter.setEmptyProvisioning(Boolean.FALSE);
    // 
    List<SysProvisioningOperationDto> operations = provisioningOperationService.find(filter, null).getContent();
    Assert.assertFalse(operations.isEmpty());
    provisioningOperation = operations.get(0);
    List<SysProvisioningAttribute> attributes = provisioningAttributeRepository.findAllByProvisioningId(provisioningOperation.getId());
    Assert.assertFalse(attributes.isEmpty());
    // 
    system.setReadonly(false);
    system = systemService.save(system);
    // 
    provisioningExecutor.execute(provisioningOperation);
    // 
    Assert.assertNull(provisioningOperationService.get(provisioningOperation.getId()));
    // checkout skeleton provisioning attributes
    attributes = provisioningAttributeRepository.findAllByProvisioningId(provisioningOperation.getId());
    Assert.assertTrue(attributes.isEmpty());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) SysProvisioningOperationFilter(eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 2 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method testOperationArchivateWithMultiUpdatedAttribute.

@Test
public void testOperationArchivateWithMultiUpdatedAttribute() {
    SysSystemDto system = getHelper().createTestResourceSystem(false);
    // 
    IcAttribute icAttributeOne = new IcAttributeImpl(getHelper().createName(), Lists.newArrayList("valueOne", "valueTwo"));
    IcConnectorObject connectorObject = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    // 
    SysProvisioningOperationDto operation = prepareProvisioningOperation(system);
    operation.getProvisioningContext().setConnectorObject(connectorObject);
    // 
    SysProvisioningArchiveDto archive = service.archive(operation);
    // 
    List<SysProvisioningAttribute> attributes = provisioningAttributeRepository.findAllByProvisioningId(archive.getId());
    // 
    Assert.assertEquals(1, attributes.size());
    Assert.assertEquals(icAttributeOne.getName(), attributes.get(0).getName());
    Assert.assertFalse(attributes.get(0).isRemoved());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 3 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method testOperationArchivateWithSingleUpdatedAttribute.

@Test
public void testOperationArchivateWithSingleUpdatedAttribute() {
    SysSystemDto system = getHelper().createTestResourceSystem(false);
    // 
    IcAttribute icAttributeOne = new IcAttributeImpl(getHelper().createName(), "valueOne");
    IcConnectorObject connectorObject = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    // 
    SysProvisioningOperationDto operation = prepareProvisioningOperation(system);
    operation.getProvisioningContext().setConnectorObject(connectorObject);
    // 
    SysProvisioningArchiveDto archive = service.archive(operation);
    // 
    List<SysProvisioningAttribute> attributes = provisioningAttributeRepository.findAllByProvisioningId(archive.getId());
    // 
    Assert.assertEquals(1, attributes.size());
    Assert.assertEquals(icAttributeOne.getName(), attributes.get(0).getName());
    Assert.assertFalse(attributes.get(0).isRemoved());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 4 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method testOperationArchivateWithMultiRemovedAttribute.

@Test
public void testOperationArchivateWithMultiRemovedAttribute() {
    SysSystemDto system = getHelper().createTestResourceSystem(false);
    // 
    IcAttribute icAttributeOne = new IcAttributeImpl(getHelper().createName(), Lists.newArrayList());
    IcConnectorObject connectorObject = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    // 
    SysProvisioningOperationDto operation = prepareProvisioningOperation(system);
    operation.getProvisioningContext().setConnectorObject(connectorObject);
    // 
    SysProvisioningArchiveDto archive = service.archive(operation);
    // 
    List<SysProvisioningAttribute> attributes = provisioningAttributeRepository.findAllByProvisioningId(archive.getId());
    // 
    Assert.assertEquals(1, attributes.size());
    Assert.assertEquals(icAttributeOne.getName(), attributes.get(0).getName());
    Assert.assertTrue(attributes.get(0).isRemoved());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 5 with SysProvisioningAttribute

use of eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute in project CzechIdMng by bcvsolutions.

the class DefaultSysProvisioningArchiveServiceIntegrationTest method testOperationArchivateWithMultiRemovedAttributeWithNullValue.

@Test
public void testOperationArchivateWithMultiRemovedAttributeWithNullValue() {
    SysSystemDto system = getHelper().createTestResourceSystem(false);
    // 
    IcAttribute icAttributeOne = new IcAttributeImpl(getHelper().createName(), Lists.newArrayList((String) null));
    IcConnectorObject connectorObject = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
    // 
    SysProvisioningOperationDto operation = prepareProvisioningOperation(system);
    operation.getProvisioningContext().setConnectorObject(connectorObject);
    // 
    SysProvisioningArchiveDto archive = service.archive(operation);
    // 
    List<SysProvisioningAttribute> attributes = provisioningAttributeRepository.findAllByProvisioningId(archive.getId());
    // 
    Assert.assertEquals(1, attributes.size());
    Assert.assertEquals(icAttributeOne.getName(), attributes.get(0).getName());
    Assert.assertTrue(attributes.get(0).isRemoved());
}
Also used : SysProvisioningAttribute(eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute) IcObjectClassImpl(eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl) IcAttributeImpl(eu.bcvsolutions.idm.ic.impl.IcAttributeImpl) IcAttribute(eu.bcvsolutions.idm.ic.api.IcAttribute) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) SysProvisioningArchiveDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto) IcConnectorObjectImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl) SysProvisioningOperationDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

SysProvisioningAttribute (eu.bcvsolutions.idm.acc.entity.SysProvisioningAttribute)16 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)10 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)10 Test (org.junit.Test)10 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)9 SysProvisioningArchiveDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningArchiveDto)7 IcAttribute (eu.bcvsolutions.idm.ic.api.IcAttribute)7 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)6 IcAttributeImpl (eu.bcvsolutions.idm.ic.impl.IcAttributeImpl)6 IcConnectorObjectImpl (eu.bcvsolutions.idm.ic.impl.IcConnectorObjectImpl)6 IcObjectClassImpl (eu.bcvsolutions.idm.ic.impl.IcObjectClassImpl)6 ProvisioningEventType (eu.bcvsolutions.idm.acc.domain.ProvisioningEventType)2 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)2 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)2 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)2 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)2 ZonedDateTime (java.time.ZonedDateTime)2 UUID (java.util.UUID)2 Predicate (javax.persistence.criteria.Predicate)2 Transactional (org.springframework.transaction.annotation.Transactional)2