use of org.olat.core.commons.services.license.model.LicenseImpl in project OpenOLAT by OpenOLAT.
the class LicenseXStreamHelperTest method shouldConvertToXmlAndBack.
@Test
public void shouldConvertToXmlAndBack() {
String licensor = "licensor";
String freetext = "freetext";
String licenseTypeName = "licenseTypeName";
LicenseTypeImpl licenseType = new LicenseTypeImpl();
licenseType.setName(licenseTypeName);
LicenseImpl license = new LicenseImpl();
license.setLicensor(licensor);
license.setFreetext(freetext);
license.setLicenseType(licenseType);
LicenseXStreamHelper licenseXStreamHelper = new LicenseXStreamHelper();
String licenseAsXml = licenseXStreamHelper.toXml(license);
System.out.println(licenseAsXml);
License licenseFromXml = licenseXStreamHelper.licenseFromXml(licenseAsXml);
assertThat(licenseFromXml.getLicensor()).isEqualTo(licensor);
assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext);
assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName);
}
use of org.olat.core.commons.services.license.model.LicenseImpl in project openolat by klemens.
the class LicenseXStreamHelperTest method shouldConvertToXmlAndBack.
@Test
public void shouldConvertToXmlAndBack() {
String licensor = "licensor";
String freetext = "freetext";
String licenseTypeName = "licenseTypeName";
LicenseTypeImpl licenseType = new LicenseTypeImpl();
licenseType.setName(licenseTypeName);
LicenseImpl license = new LicenseImpl();
license.setLicensor(licensor);
license.setFreetext(freetext);
license.setLicenseType(licenseType);
LicenseXStreamHelper licenseXStreamHelper = new LicenseXStreamHelper();
String licenseAsXml = licenseXStreamHelper.toXml(license);
System.out.println(licenseAsXml);
License licenseFromXml = licenseXStreamHelper.licenseFromXml(licenseAsXml);
assertThat(licenseFromXml.getLicensor()).isEqualTo(licensor);
assertThat(licenseFromXml.getFreetext()).isEqualTo(freetext);
assertThat(licenseFromXml.getLicenseType().getName()).isEqualTo(licenseTypeName);
}
use of org.olat.core.commons.services.license.model.LicenseImpl in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method createLicense.
@Override
public License createLicense(LicenseType licenseType) {
License license = new LicenseImpl();
license.setLicenseType(licenseType);
return license;
}
use of org.olat.core.commons.services.license.model.LicenseImpl in project OpenOLAT by OpenOLAT.
the class LicenseServiceImpl method createDefaultLicense.
@Override
public License createDefaultLicense(LicenseHandler handler, Identity licensor) {
LicenseType defautlLicenseType = getDefaultLicenseType(handler);
String licensorName = licensorFactory.create(handler, licensor);
License license = new LicenseImpl();
license.setLicenseType(defautlLicenseType);
license.setLicensor(licensorName);
return license;
}
use of org.olat.core.commons.services.license.model.LicenseImpl in project openolat by klemens.
the class LicenseServiceImpl method createDefaultLicense.
@Override
public License createDefaultLicense(LicenseHandler handler, Identity licensor) {
LicenseType defautlLicenseType = getDefaultLicenseType(handler);
String licensorName = licensorFactory.create(handler, licensor);
License license = new LicenseImpl();
license.setLicenseType(defautlLicenseType);
license.setLicensor(licensorName);
return license;
}
Aggregations