From 3d3e7898b6018afdd148d680e42d62f6e0a05ebd Mon Sep 17 00:00:00 2001 From: Slava Rudkovskyi Date: Tue, 16 May 2023 14:23:37 +0200 Subject: [PATCH] rename "licenseTemplatesNumbers" to "licenseTemplateNumbers" --- .../labs64/netlicensing/domain/Constants.java | 2 +- .../netlicensing/domain/entity/Bundle.java | 4 +-- .../domain/entity/impl/BundleImpl.java | 26 +++++++------- .../converter/ItemToBundleConverter.java | 6 ++-- .../service/BundleServiceTest.java | 36 +++++++++---------- .../mock/netlicensing-bundle-get.xml | 2 +- .../mock/netlicensing-bundle-list.xml | 6 ++-- .../mock/netlicensing-bundle-update.xml | 2 +- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java index a1318cd5..0437304d 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/Constants.java @@ -231,7 +231,7 @@ public static final class Bundle { public static final String ENDPOINT_PATH = "bundle"; public static final String ENDPOINT_OBTAIN_PATH = "obtain"; public static final String DESCRIPTION = "description"; - public static final String LICENSE_TEMPLATES_NUMBERS = "licenseTemplatesNumbers"; + public static final String LICENSE_TEMPLATE_NUMBERS = "licenseTemplateNumbers"; } // CHECKSTYLE:ON } diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/Bundle.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/Bundle.java index c8686e5d..4e855425 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/Bundle.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/Bundle.java @@ -22,9 +22,9 @@ public interface Bundle extends BaseEntity { String getDescription(); - void setLicenseTemplatesNumbers(List licenseTemplatesNumbers); + void setLicenseTemplateNumbers(List licenseTemplateNumbers); - List getLicenseTemplatesNumbers(); + List getLicenseTemplateNumbers(); void addLicenseTemplateNumber(String licenseTemplateNumber); diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/impl/BundleImpl.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/impl/BundleImpl.java index c4c43c82..6e6214cc 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/impl/BundleImpl.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/domain/entity/impl/BundleImpl.java @@ -19,7 +19,7 @@ public class BundleImpl extends BaseEntityImpl implements Bundle { private Currency currency; - private List licenseTemplatesNumbers; + private List licenseTemplateNumbers; @Override public void setName(final String name) { @@ -62,31 +62,31 @@ public String getDescription() { } @Override - public void setLicenseTemplatesNumbers(final List licenseTemplatesNumbers) { - this.licenseTemplatesNumbers = licenseTemplatesNumbers; + public void setLicenseTemplateNumbers(final List licenseTemplateNumbers) { + this.licenseTemplateNumbers = licenseTemplateNumbers; } @Override - public List getLicenseTemplatesNumbers() { - return licenseTemplatesNumbers; + public List getLicenseTemplateNumbers() { + return licenseTemplateNumbers; } @Override public void addLicenseTemplateNumber(final String licenseTemplateNumber) { - if (getLicenseTemplatesNumbers() == null) { - this.licenseTemplatesNumbers = new ArrayList<>(); + if (getLicenseTemplateNumbers() == null) { + this.licenseTemplateNumbers = new ArrayList<>(); } - this.licenseTemplatesNumbers.add(licenseTemplateNumber); + this.licenseTemplateNumbers.add(licenseTemplateNumber); } @Override public void removeLicenseTemplateNumber(final String licenseTemplateNumber) { - if (getLicenseTemplatesNumbers() == null) { + if (getLicenseTemplateNumbers() == null) { return; } - getLicenseTemplatesNumbers().remove(licenseTemplateNumber); + getLicenseTemplateNumbers().remove(licenseTemplateNumber); } public static List getReservedProps() { @@ -95,7 +95,7 @@ public static List getReservedProps() { reserved.add(Constants.Bundle.DESCRIPTION); reserved.add(Constants.PRICE); reserved.add(Constants.CURRENCY); - reserved.add(Constants.Bundle.LICENSE_TEMPLATES_NUMBERS); + reserved.add(Constants.Bundle.LICENSE_TEMPLATE_NUMBERS); return reserved; } @@ -111,8 +111,8 @@ protected MultivaluedMap asPropertiesMap() { map.add(Constants.PRICE, getPrice()); map.add(Constants.CURRENCY, getCurrency()); - if (getLicenseTemplatesNumbers() != null) { - map.add(Constants.Bundle.LICENSE_TEMPLATES_NUMBERS, String.join(",", getLicenseTemplatesNumbers())); + if (getLicenseTemplateNumbers() != null) { + map.add(Constants.Bundle.LICENSE_TEMPLATE_NUMBERS, String.join(",", getLicenseTemplateNumbers())); } return map; diff --git a/NetLicensingClient/src/main/java/com/labs64/netlicensing/schema/converter/ItemToBundleConverter.java b/NetLicensingClient/src/main/java/com/labs64/netlicensing/schema/converter/ItemToBundleConverter.java index 092e6280..10afd915 100644 --- a/NetLicensingClient/src/main/java/com/labs64/netlicensing/schema/converter/ItemToBundleConverter.java +++ b/NetLicensingClient/src/main/java/com/labs64/netlicensing/schema/converter/ItemToBundleConverter.java @@ -42,10 +42,10 @@ public Bundle convert(final Item source) throws ConversionException { target.setCurrency(Currency.valueOf(price.getCurrencyCode())); } - final String licenseTemplatesNumbers = SchemaFunction.propertyByName(source.getProperty(), Constants.Bundle.LICENSE_TEMPLATES_NUMBERS).getValue(); + final String licenseTemplateNumbers = SchemaFunction.propertyByName(source.getProperty(), Constants.Bundle.LICENSE_TEMPLATE_NUMBERS).getValue(); - if (licenseTemplatesNumbers != null) { - target.setLicenseTemplatesNumbers(Arrays.asList(licenseTemplatesNumbers.split(","))); + if (licenseTemplateNumbers != null) { + target.setLicenseTemplateNumbers(Arrays.asList(licenseTemplateNumbers.split(","))); } // Custom properties diff --git a/NetLicensingClient/src/test/java/com/labs64/netlicensing/service/BundleServiceTest.java b/NetLicensingClient/src/test/java/com/labs64/netlicensing/service/BundleServiceTest.java index f2fcb093..46a88c21 100644 --- a/NetLicensingClient/src/test/java/com/labs64/netlicensing/service/BundleServiceTest.java +++ b/NetLicensingClient/src/test/java/com/labs64/netlicensing/service/BundleServiceTest.java @@ -108,9 +108,9 @@ public void testCreate() throws Exception { final boolean active = true; final BigDecimal price = new BigDecimal(10); final Currency currency = Currency.EUR; - final List licenseTemplatesNumbers = new ArrayList<>(); - licenseTemplatesNumbers.add("LT001-TEST"); - licenseTemplatesNumbers.add("LT002-TEST"); + final List licenseTemplateNumbers = new ArrayList<>(); + licenseTemplateNumbers.add("LT001-TEST"); + licenseTemplateNumbers.add("LT002-TEST"); final Bundle bundle = new BundleImpl(); bundle.setName(name); @@ -119,7 +119,7 @@ public void testCreate() throws Exception { bundle.setActive(active); bundle.setPrice(price); bundle.setCurrency(currency); - bundle.setLicenseTemplatesNumbers(licenseTemplatesNumbers); + bundle.setLicenseTemplateNumbers(licenseTemplateNumbers); final Bundle createdBundle = BundleService.create(context, bundle); @@ -130,7 +130,7 @@ public void testCreate() throws Exception { assertEquals(active, createdBundle.getActive()); assertEquals(price, createdBundle.getPrice()); assertEquals(currency, createdBundle.getCurrency()); - assertEquals(licenseTemplatesNumbers, createdBundle.getLicenseTemplatesNumbers()); + assertEquals(licenseTemplateNumbers, createdBundle.getLicenseTemplateNumbers()); } @Test @@ -141,9 +141,9 @@ public void testGet() throws Exception { final boolean active = true; final BigDecimal price = new BigDecimal(10); final Currency currency = Currency.EUR; - final List licenseTemplatesNumbers = new ArrayList<>(); - licenseTemplatesNumbers.add("LT001-TEST"); - licenseTemplatesNumbers.add("LT002-TEST"); + final List licenseTemplateNumbers = new ArrayList<>(); + licenseTemplateNumbers.add("LT001-TEST"); + licenseTemplateNumbers.add("LT002-TEST"); final Bundle bundle = BundleService.get(context, "B014-TEST"); assertNotNull(bundle); @@ -153,15 +153,15 @@ public void testGet() throws Exception { assertEquals(active, bundle.getActive()); assertEquals(price, bundle.getPrice()); assertEquals(currency, bundle.getCurrency()); - assertEquals(licenseTemplatesNumbers, bundle.getLicenseTemplatesNumbers()); + assertEquals(licenseTemplateNumbers, bundle.getLicenseTemplateNumbers()); } @Test public void testList() throws Exception { final Page bundles = BundleService.list(context, null); - final List licenseTemplatesNumbers = new ArrayList<>(); - licenseTemplatesNumbers.add("LT005-TEST"); - licenseTemplatesNumbers.add("LT006-TEST"); + final List licenseTemplateNumbers = new ArrayList<>(); + licenseTemplateNumbers.add("LT005-TEST"); + licenseTemplateNumbers.add("LT006-TEST"); assertNotNull(bundles); @@ -171,7 +171,7 @@ public void testList() throws Exception { assertEquals("Bundle 2", bundles.getContent().get(1).getName()); assertEquals(Currency.USD, bundles.getContent().get(1).getCurrency()); assertEquals(BigDecimal.valueOf(30), bundles.getContent().get(2).getPrice()); - assertEquals(licenseTemplatesNumbers, bundles.getContent().get(2).getLicenseTemplatesNumbers()); + assertEquals(licenseTemplateNumbers, bundles.getContent().get(2).getLicenseTemplateNumbers()); } @Test @@ -182,9 +182,9 @@ public void testUpdate() throws Exception { final boolean active = false; final BigDecimal price = new BigDecimal(20); final Currency currency = Currency.USD; - final List licenseTemplatesNumbers = new ArrayList<>(); - licenseTemplatesNumbers.add("LT003-TEST"); - licenseTemplatesNumbers.add("LT004-TEST"); + final List licenseTemplateNumbers = new ArrayList<>(); + licenseTemplateNumbers.add("LT003-TEST"); + licenseTemplateNumbers.add("LT004-TEST"); final Bundle bundle = new BundleImpl(); bundle.setName(name); @@ -193,7 +193,7 @@ public void testUpdate() throws Exception { bundle.setActive(active); bundle.setPrice(price); bundle.setCurrency(currency); - bundle.setLicenseTemplatesNumbers(licenseTemplatesNumbers); + bundle.setLicenseTemplateNumbers(licenseTemplateNumbers); final Bundle updatedBundle = BundleService.create(context, bundle); @@ -204,7 +204,7 @@ public void testUpdate() throws Exception { assertEquals(active, updatedBundle.getActive()); assertEquals(price, updatedBundle.getPrice()); assertEquals(currency, updatedBundle.getCurrency()); - assertEquals(licenseTemplatesNumbers, updatedBundle.getLicenseTemplatesNumbers()); + assertEquals(licenseTemplateNumbers, updatedBundle.getLicenseTemplateNumbers()); } @Test diff --git a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-get.xml b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-get.xml index 240f360c..d5f2b50d 100644 --- a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-get.xml +++ b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-get.xml @@ -10,7 +10,7 @@ Description 1 10 EUR - LT001-TEST,LT002-TEST + LT001-TEST,LT002-TEST diff --git a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-list.xml b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-list.xml index 9b9b42f5..f0b59e8c 100644 --- a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-list.xml +++ b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-list.xml @@ -10,7 +10,7 @@ Description 1 10 EUR - LT001-TEST,LT002-TEST + LT001-TEST,LT002-TEST B002-TEST @@ -19,7 +19,7 @@ Description 2 20 USD - LT003-TEST,LT004-TEST + LT003-TEST,LT004-TEST B003-TEST @@ -28,7 +28,7 @@ Description 3 30 EUR - LT005-TEST,LT006-TEST + LT005-TEST,LT006-TEST diff --git a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-update.xml b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-update.xml index 45466671..86c4c372 100644 --- a/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-update.xml +++ b/NetLicensingClient/src/test/resources/mock/netlicensing-bundle-update.xml @@ -10,7 +10,7 @@ Description 2 20.00 USD - LT003-TEST,LT004-TEST + LT003-TEST,LT004-TEST