org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CMISTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * MNT-11304: Test that Alfresco has no default boundaries for decimals * @throws Exception */ @Test public void testDecimalDefaultBoundaries() throws Exception { AuthenticationUtil.pushAuthentication(); AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); try { withCmisService(new CmisServiceCallback<Void>() { @Override public Void execute(CmisService cmisService) { List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null); assertTrue(repositories.size() > 0); RepositoryInfo repo = repositories.get(0); String repositoryId = repo.getId(); TypeDefinition decimalTypeDef = cmisService.getTypeDefinition(repositoryId, "D:tcdm:testdecimalstype", null); PropertyDecimalDefinitionImpl floatNoBoundsTypeDef = (PropertyDecimalDefinitionImpl)decimalTypeDef.getPropertyDefinitions().get("tcdm:float"); PropertyDecimalDefinitionImpl doubleNoBoundsTypeDef = (PropertyDecimalDefinitionImpl)decimalTypeDef.getPropertyDefinitions().get("tcdm:double"); PropertyDecimalDefinitionImpl floatWithBoundsTypeDef = (PropertyDecimalDefinitionImpl)decimalTypeDef.getPropertyDefinitions().get("tcdm:floatwithbounds"); PropertyDecimalDefinitionImpl doubleWithBoundsTypeDef = (PropertyDecimalDefinitionImpl)decimalTypeDef.getPropertyDefinitions().get("tcdm:doublewithbounds"); // test that there is not default boundaries for decimals assertNull(floatNoBoundsTypeDef.getMinValue()); assertNull(floatNoBoundsTypeDef.getMaxValue()); assertNull(doubleNoBoundsTypeDef.getMinValue()); assertNull(doubleNoBoundsTypeDef.getMaxValue()); // test for pre-defined boundaries assertTrue(floatWithBoundsTypeDef.getMinValue().equals(BigDecimal.valueOf(-10f))); assertTrue(floatWithBoundsTypeDef.getMaxValue().equals(BigDecimal.valueOf(10f))); assertTrue(doubleWithBoundsTypeDef.getMinValue().equals(BigDecimal.valueOf(-10d))); assertTrue(doubleWithBoundsTypeDef.getMaxValue().equals(BigDecimal.valueOf(10d))); return null; } }, CmisVersion.CMIS_1_1); } finally { AuthenticationUtil.popAuthentication(); } }