use of org.junit.Assert.assertEquals in project jtharness by openjdk.
the class Filtering method absorbingExceptions_exceptionThrownOut.
@Test
public void absorbingExceptions_exceptionThrownOut() {
try {
final TestResult run = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {
Values values = createColumn(Double.class, Class.class).filter((Values.Transformer1<Class<?>>) c -> c.getConstructor().newInstance());
@TestCase
@TestData("values")
public void myTest(Object s) {
System.out.println("s = " + s);
}
});
Assert.fail("Exception expected");
} catch (RuntimeException e) {
Assert.assertTrue(e.getCause() instanceof InvocationTargetException);
Assert.assertTrue(e.getCause().getCause() instanceof NoSuchMethodException);
Assert.assertEquals("java.lang.Double.<init>()", e.getCause().getCause().getMessage());
}
}
use of org.junit.Assert.assertEquals in project parquet-mr by apache.
the class TestParquetMetadataConverter method testParquetMetadataConverterWithoutDictionary.
@Test
public void testParquetMetadataConverterWithoutDictionary() throws IOException {
ParquetMetadata parquetMetaData = createParquetMetaData(null, Encoding.PLAIN);
ParquetMetadataConverter converter = new ParquetMetadataConverter();
FileMetaData fmd1 = converter.toParquetMetadata(1, parquetMetaData);
// Flag should be false
fmd1.row_groups.forEach(rowGroup -> rowGroup.columns.forEach(column -> {
assertFalse(column.meta_data.isSetDictionary_page_offset());
}));
ByteArrayOutputStream metaDataOutputStream = new ByteArrayOutputStream();
Util.writeFileMetaData(fmd1, metaDataOutputStream);
ByteArrayInputStream metaDataInputStream = new ByteArrayInputStream(metaDataOutputStream.toByteArray());
FileMetaData fmd2 = Util.readFileMetaData(metaDataInputStream);
ParquetMetadata pmd2 = converter.fromParquetMetadata(fmd2);
long dicOffsetConverted = pmd2.getBlocks().get(0).getColumns().get(0).getDictionaryPageOffset();
Assert.assertEquals(0, dicOffsetConverted);
}
use of org.junit.Assert.assertEquals in project parquet-mr by apache.
the class TestParquetMetadataConverter method testParquetMetadataConverterWithDictionary.
@Test
public void testParquetMetadataConverterWithDictionary() throws IOException {
ParquetMetadata parquetMetaData = createParquetMetaData(Encoding.PLAIN_DICTIONARY, Encoding.PLAIN);
ParquetMetadataConverter converter = new ParquetMetadataConverter();
FileMetaData fmd1 = converter.toParquetMetadata(1, parquetMetaData);
// Flag should be true
fmd1.row_groups.forEach(rowGroup -> rowGroup.columns.forEach(column -> {
assertTrue(column.meta_data.isSetDictionary_page_offset());
}));
ByteArrayOutputStream metaDataOutputStream = new ByteArrayOutputStream();
Util.writeFileMetaData(fmd1, metaDataOutputStream);
ByteArrayInputStream metaDataInputStream = new ByteArrayInputStream(metaDataOutputStream.toByteArray());
FileMetaData fmd2 = Util.readFileMetaData(metaDataInputStream);
ParquetMetadata parquetMetaDataConverted = converter.fromParquetMetadata(fmd2);
long dicOffsetOriginal = parquetMetaData.getBlocks().get(0).getColumns().get(0).getDictionaryPageOffset();
long dicOffsetConverted = parquetMetaDataConverted.getBlocks().get(0).getColumns().get(0).getDictionaryPageOffset();
Assert.assertEquals(dicOffsetOriginal, dicOffsetConverted);
}
use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningServiceTest method compileAttributesOverrloadedDisabledTest.
@Test
@Transactional
public void compileAttributesOverrloadedDisabledTest() {
List<AttributeMapping> defaultAttributes = new ArrayList<>();
List<SysRoleSystemAttributeDto> overloadingAttributes = new ArrayList<>();
initDataSystem();
SysSchemaAttributeDto attOne = new SysSchemaAttributeDto();
attOne.setName("attOne");
attOne.setObjectClass(objectClasses.get(0).getId());
attOne.setClassType(String.class.getName());
attOne = schemaAttributeService.save(attOne);
SysSchemaAttributeDto attTwo = new SysSchemaAttributeDto();
attTwo.setName("attTwo");
attTwo.setObjectClass(objectClasses.get(0).getId());
attTwo.setClassType(String.class.getName());
attTwo = schemaAttributeService.save(attTwo);
SysSystemAttributeMappingDto defOne = new SysSystemAttributeMappingDto();
defOne.setEntityAttribute(true);
defOne.setIdmPropertyName("one");
defOne.setName("defOne");
defOne.setDisabledAttribute(true);
defOne.setSchemaAttribute(attOne.getId());
defOne.setSystemMapping(systemMapping.getId());
defOne = systemAttributeMappingService.save(defOne);
defaultAttributes.add(defOne);
SysSystemAttributeMappingDto defTwo = new SysSystemAttributeMappingDto();
defTwo.setEntityAttribute(true);
defTwo.setIdmPropertyName("two");
defTwo.setName("defTwo");
defTwo.setSchemaAttribute(attTwo.getId());
defTwo.setSystemMapping(systemMapping.getId());
defTwo = systemAttributeMappingService.save(defTwo);
defaultAttributes.add(defTwo);
IdmRoleDto roleOne = new IdmRoleDto();
roleOne.setCode("roleOne");
roleOne.setPriority(100);
roleOne = roleService.save(roleOne);
SysRoleSystemDto roleSystem = new SysRoleSystemDto();
roleSystem.setRole(roleOne.getId());
roleSystem.setSystem(system.getId());
roleSystem.setSystemMapping(systemMapping.getId());
roleSystem = roleSystemService.save(roleSystem);
SysRoleSystemAttributeDto overloadedOne = new SysRoleSystemAttributeDto();
overloadedOne.setSystemAttributeMapping(defOne.getId());
overloadedOne.setEntityAttribute(true);
overloadedOne.setIdmPropertyName("one");
overloadedOne.setName("defOneOverloaded");
overloadedOne.setDisabledDefaultAttribute(false);
overloadedOne.setRoleSystem(roleSystem.getId());
overloadedOne = roleSystemAttributeService.save(overloadedOne);
overloadingAttributes.add(overloadedOne);
List<AttributeMapping> compilledAttributes = provisioningService.compileAttributes(defaultAttributes, overloadingAttributes, SystemEntityType.IDENTITY);
Assert.assertEquals(2, compilledAttributes.size());
Assert.assertTrue(compilledAttributes.stream().filter(attribute -> {
return "defOneOverloaded".equals(attribute.getName());
}).findFirst().isPresent());
}
use of org.junit.Assert.assertEquals in project CzechIdMng by bcvsolutions.
the class DefaultSysProvisioningArchiveServiceIntegrationTest method differenceObjectMultipleTest.
@Test
public void differenceObjectMultipleTest() {
String attrName = getHelper().createName();
IcAttributeImpl icAttributeOne = new IcAttributeImpl(attrName, Lists.newArrayList("TESTExisting", "TESTRemoved"));
IcConnectorObject connObjectOld = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeOne));
IcAttributeImpl icAttributeTwo = new IcAttributeImpl(attrName, Lists.newArrayList("TESTExisting", "TESTNew"));
IcConnectorObject connObjectNew = new IcConnectorObjectImpl(getHelper().createName(), new IcObjectClassImpl("__mock__"), ImmutableList.of(icAttributeTwo));
List<SysAttributeDifferenceDto> diffs = service.evaluateProvisioningDifferences(connObjectOld, connObjectNew);
List<SysAttributeDifferenceValueDto> values = diffs.get(0).getValues();
Assert.assertEquals(1, diffs.size());
Assert.assertTrue(diffs.get(0).isMultivalue());
Assert.assertTrue(diffs.get(0).isChanged());
Assert.assertNotNull(values);
Assert.assertEquals(3, values.size());
SysAttributeDifferenceValueDto value;
value = values.stream().filter(item -> item.getChange() == null).findFirst().orElse(null);
Assert.assertNotNull(value);
Assert.assertEquals("TESTExisting", value.getValue());
Assert.assertEquals("TESTExisting", value.getOldValue());
value = values.stream().filter(item -> item.getChange() == SysValueChangeType.ADDED).findFirst().orElse(null);
Assert.assertNotNull(value);
Assert.assertEquals("TESTNew", value.getValue());
Assert.assertEquals(null, value.getOldValue());
value = values.stream().filter(item -> item.getChange() == SysValueChangeType.REMOVED).findFirst().orElse(null);
Assert.assertNotNull(value);
Assert.assertEquals("TESTRemoved", value.getValue());
Assert.assertEquals("TESTRemoved", value.getOldValue());
}
Aggregations