/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Assertions.argumentNotNull(message, "message may not be null");
this.observedKey = observedKey;
- this.observedClass = observedClass.getCanonicalName();
+ this.observedClass = observedClass.getName();
this.validationResult = validationResult;
this.message = message;
}
// check first item
PfValidationMessage msg = it.next();
- assertEquals(MyValid.class.getName().replace('$', '.'), msg.getObservedClass());
+ assertEquals(MyValid.class.getName(), msg.getObservedClass());
assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
assertTrue(msg.getMessage().contains("index.0 invalid-wrong value"));
// check null value
msg = it.next();
- assertEquals(MyValid.class.getName().replace('$', '.'), msg.getObservedClass());
+ assertEquals(MyValid.class.getName(), msg.getObservedClass());
assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
assertTrue(msg.getMessage().contains("index.2 invalid-wrong value"));
// check first item
PfValidationMessage msg = it.next();
- assertEquals(MyConcept.class.getName().replace('$', '.'), msg.getObservedClass());
+ assertEquals(MyConcept.class.getName(), msg.getObservedClass());
assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
assertTrue(msg.getMessage().contains("index.0 invalid-wrong value"));
// check null value
msg = it.next();
- assertEquals(MyConcept.class.getName().replace('$', '.'), msg.getObservedClass());
+ assertEquals(MyConcept.class.getName(), msg.getObservedClass());
assertEquals(MY_TO_STRING, msg.getObservedKey().toString());
assertTrue(msg.getMessage().contains("index.2 invalid-wrong value"));
assertEquals(PfValidationResult.ValidationResult.INVALID, result.getMessageList().get(3).getValidationResult());
assertEquals(SOME_MESSAGE, result.getMessageList().get(3).getMessage());
- assertEquals(PfConceptKey.class.getCanonicalName(), result.getMessageList().get(3).getObservedClass());
+ assertEquals(PfConceptKey.class.getName(), result.getMessageList().get(3).getObservedClass());
assertEquals(PfConceptKey.getNullKey(), result.getMessageList().get(3).getObservedKey());
}
}
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
t.copyTo(clonedT);
return clonedT;
} catch (final Exception e) {
- LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e);
+ LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e);
return null;
}
} else {
t.copyTo(clonedT);
return clonedT;
} catch (final Exception e) {
- LOGGER.warn("Could not clone object of class \"" + someClass.getCanonicalName() + "\"", e);
+ LOGGER.warn("Could not clone object of class \"" + someClass.getName() + "\"", e);
return null;
}
} else {
public void testEntityTestAllOpsJpa() throws PfModelException {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("DaoTest");
Properties jdbcProperties = new Properties();
@Test
public void testEntityTestBadVals() throws PfModelException {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("DaoTest");
pfDao = new PfDaoFactory().createPfDao(daoParameters);
}
public void dump(Object obj) {
- logger.debug("Dumping ", obj.getClass().getCanonicalName());
+ logger.debug("Dumping ", obj.getClass().getName());
logger.debug("{}", obj);
}
}
}
public void dump(Object obj) {
- logger.debug("Dumping {}", obj.getClass().getCanonicalName());
+ logger.debug("Dumping {}", obj.getClass().getName());
logger.debug("{}", obj);
}
}
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.getClass().getCanonicalName().compareTo(otherConcept.getClass().getCanonicalName());
+ return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaPdpGroup other = (JpaPdpGroup) otherConcept;
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// It is, now check if it is a PolicyModelsProvider
if (!PolicyModelsProvider.class.isAssignableFrom(implementationClass)) {
- String errorMessage = "the class \"" + implementationClass.getCanonicalName()
+ String errorMessage = "the class \"" + implementationClass.getName()
+ "\" is not an implementation of the \"PolicyModelsProvider\" interface";
LOGGER.warn(errorMessage);
throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@Data
public class PolicyModelsProviderParameters implements ParameterGroup {
- private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getCanonicalName();
+ private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getName();
private String name;
private String implementation = DEFAULT_IMPLEMENTATION;
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// Parameters for the DAO
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
// Decode the password using Base64
@Test
public void testProvider() throws Exception {
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getCanonicalName());
+ parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getName());
parameters.setDatabaseUrl("jdbc:dummy");
parameters.setPersistenceUnit("dummy");
@Test
public void testProviderMethods() throws Exception {
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getCanonicalName());
+ parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getName());
parameters.setDatabaseUrl("jdbc:dummy");
parameters.setPersistenceUnit("dummy");
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
if (commandLine.hasOption('h')) {
- return help(Main.class.getCanonicalName());
+ return help(Main.class.getName());
}
if (commandLine.hasOption('v')) {
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
if (commandLine.hasOption('h')) {
- return help(Main.class.getCanonicalName());
+ return help(Main.class.getName());
}
if (commandLine.hasOption('v')) {
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
@Before
public void setupDao() throws Exception {
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit("ToscaConceptTest");
firstDataTypeFirstProperty.getDescription());
assertTrue(firstDataTypeFirstProperty.getConstraints().size() == 1);
assertEquals("org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues",
- firstDataTypeFirstProperty.getConstraints().iterator().next().getClass().getCanonicalName());
+ firstDataTypeFirstProperty.getConstraints().iterator().next().getClass().getName());
assertTrue(((JpaToscaConstraintValidValues) (firstDataTypeFirstProperty.getConstraints().iterator().next()))
.getValidValues().size() == 2);