diff --git a/performance-tests/pom.xml b/performance-tests/pom.xml
new file mode 100644
index 0000000000..3f25796516
--- /dev/null
+++ b/performance-tests/pom.xml
@@ -0,0 +1,79 @@
+
+
+
+ parent-modules
+ com.baeldung
+ 1.0.0-SNAPSHOT
+
+ 4.0.0
+
+ performancetests
+
+
+
+ ma.glasnost.orika
+ orika-core
+ 1.5.2
+
+
+ net.sf.dozer
+ dozer
+ 5.5.1
+
+
+ io.craftsman
+ dozer-jdk8-support
+ 1.0.2
+
+
+ org.mapstruct
+ mapstruct-jdk8
+ 1.2.0.Final
+
+
+ org.modelmapper
+ modelmapper
+ 1.1.0
+
+
+ com.googlecode.jmapper-framework
+ jmapper-core
+ 1.6.0.1
+
+
+ org.openjdk.jmh
+ jmh-core
+ 1.20
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ 1.20
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.5.1
+
+
+ 1.8
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.2.0.Final
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/Converter.java b/performance-tests/src/main/java/com/baeldung/performancetests/Converter.java
new file mode 100644
index 0000000000..097600849b
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/Converter.java
@@ -0,0 +1,11 @@
+package com.baeldung.performancetests;
+
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+
+public interface Converter {
+ Order convert(SourceOrder sourceOrder);
+ DestinationCode convert(SourceCode sourceCode);
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java
new file mode 100644
index 0000000000..710145ec58
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/dozer/DozerConverter.java
@@ -0,0 +1,29 @@
+package com.baeldung.performancetests.dozer;
+
+import com.baeldung.performancetests.Converter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+import org.dozer.DozerBeanMapper;
+import org.dozer.Mapper;
+
+ public class DozerConverter implements Converter {
+ private final Mapper mapper;
+
+ public DozerConverter() {
+ DozerBeanMapper mapper = new DozerBeanMapper();
+ mapper.addMapping(DozerConverter.class.getResourceAsStream("/dozer-mapping.xml"));
+ this.mapper = mapper;
+ }
+
+ @Override
+ public Order convert(SourceOrder sourceOrder) {
+ return mapper.map(sourceOrder,Order.class);
+ }
+
+ @Override
+ public DestinationCode convert(SourceCode sourceCode) {
+ return mapper.map(sourceCode, DestinationCode.class);
+ }
+ }
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/jmapper/JMapperConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/jmapper/JMapperConverter.java
new file mode 100644
index 0000000000..b61cfbb771
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/jmapper/JMapperConverter.java
@@ -0,0 +1,30 @@
+package com.baeldung.performancetests.jmapper;
+
+import com.baeldung.performancetests.Converter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+import com.googlecode.jmapper.JMapper;
+import com.googlecode.jmapper.api.JMapperAPI;
+
+public class JMapperConverter implements Converter {
+ JMapper realLifeMapper;
+ JMapper simpleMapper;
+ public JMapperConverter() {
+ JMapperAPI api = new JMapperAPI().add(JMapperAPI.mappedClass(Order.class));
+ realLifeMapper = new JMapper(Order.class, SourceOrder.class, api);
+ JMapperAPI simpleApi = new JMapperAPI().add(JMapperAPI.mappedClass(DestinationCode.class));
+ simpleMapper = new JMapper(DestinationCode.class, SourceCode.class, simpleApi);
+ }
+
+ @Override
+ public Order convert(SourceOrder sourceOrder) {
+ return (Order) realLifeMapper.getDestination(sourceOrder);
+ }
+
+ @Override
+ public DestinationCode convert(SourceCode sourceCode) {
+ return (DestinationCode) simpleMapper.getDestination(sourceCode);
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/mapstruct/MapStructConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/mapstruct/MapStructConverter.java
new file mode 100644
index 0000000000..27ec6e6c83
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/mapstruct/MapStructConverter.java
@@ -0,0 +1,22 @@
+package com.baeldung.performancetests.mapstruct;
+
+import com.baeldung.performancetests.Converter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+import org.mapstruct.Mapper;
+import org.mapstruct.Mapping;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public interface MapStructConverter extends Converter {
+ MapStructConverter MAPPER = Mappers.getMapper(MapStructConverter.class);
+
+ @Mapping(source = "status", target = "orderStatus")
+ @Override
+ Order convert(SourceOrder sourceOrder);
+
+ @Override
+ DestinationCode convert(SourceCode sourceCode);
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/AccountStatus.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/AccountStatus.java
new file mode 100644
index 0000000000..c435a73b56
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/AccountStatus.java
@@ -0,0 +1,5 @@
+package com.baeldung.performancetests.model.destination;
+
+public enum AccountStatus {
+ ACTIVE, NOT_ACTIVE, BANNED
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Address.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Address.java
new file mode 100644
index 0000000000..9107f47455
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Address.java
@@ -0,0 +1,83 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.util.Objects;
+
+@JGlobalMap
+public class Address {
+ private String street;
+ private String city;
+ private String postalCode;
+
+ public Address() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if(o.getClass() == com.baeldung.performancetests.model.source.Address.class) {
+ com.baeldung.performancetests.model.source.Address address =
+ (com.baeldung.performancetests.model.source.Address) o;
+ return Objects.equals(street, address.getStreet()) &&
+ Objects.equals(city, address.getCity()) &&
+ Objects.equals(postalCode, address.getPostalCode()) &&
+ Objects.equals(country, address.getCountry());
+ }
+ if(o.getClass() != getClass()) return false;
+ Address address = (Address) o;
+ return Objects.equals(street, address.street) &&
+ Objects.equals(city, address.city) &&
+ Objects.equals(postalCode, address.postalCode) &&
+ Objects.equals(country, address.country);
+ }
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash(street, city, postalCode, country);
+ }
+
+ private String country;
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public Address(String street, String city, String postalCode, String country) {
+
+ this.street = street;
+ this.city = city;
+ this.postalCode = postalCode;
+ this.country = country;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DeliveryData.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DeliveryData.java
new file mode 100644
index 0000000000..1d9bde1088
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DeliveryData.java
@@ -0,0 +1,83 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+import com.googlecode.jmapper.annotations.JMapAccessor;
+
+import java.util.Objects;
+
+@JGlobalMap
+public class DeliveryData {
+ private Address deliveryAddress;
+ @JMapAccessor(get = "isPrePaid", set = "setPrePaid")
+ private boolean isPrePaid;
+ private String trackingCode;
+ private int expectedDeliveryTimeInDays;
+
+ public DeliveryData() {
+ }
+
+ public Address getDeliveryAddress() {
+ return deliveryAddress;
+ }
+
+ public void setDeliveryAddress(Address deliveryAddress) {
+ this.deliveryAddress = deliveryAddress;
+ }
+
+ public boolean isPrePaid() {
+ return isPrePaid;
+ }
+
+ public void setPrePaid(boolean prePaid) {
+ isPrePaid = prePaid;
+ }
+
+ public String getTrackingCode() {
+ return trackingCode;
+ }
+
+ public void setTrackingCode(String trackingCode) {
+ this.trackingCode = trackingCode;
+ }
+
+ public int getExpectedDeliveryTimeInDays() {
+ return expectedDeliveryTimeInDays;
+ }
+
+ public void setExpectedDeliveryTimeInDays(int expectedDeliveryTimeInDays) {
+ this.expectedDeliveryTimeInDays = expectedDeliveryTimeInDays;
+ }
+
+ public DeliveryData(Address deliveryAddress, boolean isPrePaid, String trackingCode, int expectedDeliveryTimeInDays) {
+ this.deliveryAddress = deliveryAddress;
+ this.isPrePaid = isPrePaid;
+ this.trackingCode = trackingCode;
+ this.expectedDeliveryTimeInDays = expectedDeliveryTimeInDays;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if(o.getClass() == com.baeldung.performancetests.model.source.DeliveryData.class) {
+ com.baeldung.performancetests.model.source.DeliveryData deliveryData =
+ (com.baeldung.performancetests.model.source.DeliveryData) o;
+ return isPrePaid == deliveryData.isPrePaid() &&
+ expectedDeliveryTimeInDays == deliveryData.getExpectedDeliveryTimeInDays() &&
+ Objects.equals(deliveryAddress, deliveryData.getDeliveryAddress()) &&
+ Objects.equals(trackingCode, deliveryData.getTrackingCode());
+ }
+ if (o.getClass() != getClass()) return false;
+ DeliveryData that = (DeliveryData) o;
+ return isPrePaid == that.isPrePaid &&
+ expectedDeliveryTimeInDays == that.expectedDeliveryTimeInDays &&
+ Objects.equals(deliveryAddress, that.deliveryAddress) &&
+ Objects.equals(trackingCode, that.trackingCode);
+ }
+
+ @Override
+ public int hashCode() {
+
+ return Objects.hash(deliveryAddress, isPrePaid, trackingCode, expectedDeliveryTimeInDays);
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DestinationCode.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DestinationCode.java
new file mode 100644
index 0000000000..d0a7985db8
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/DestinationCode.java
@@ -0,0 +1,23 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.googlecode.jmapper.annotations.JMap;
+
+public class DestinationCode {
+ @JMap
+ String code;
+
+ public DestinationCode(String code) {
+ this.code = code;
+ }
+
+ public DestinationCode() {
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Discount.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Discount.java
new file mode 100644
index 0000000000..920cc71a7e
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Discount.java
@@ -0,0 +1,70 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.google.common.base.Objects;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.math.BigDecimal;
+
+@JGlobalMap
+public class Discount {
+ private String startTime;
+ private String endTime;
+ private BigDecimal discountPrice;
+
+ public Discount() {
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if (o.getClass() == com.baeldung.performancetests.model.source.Discount.class) {
+ com.baeldung.performancetests.model.source.Discount discount =
+ (com.baeldung.performancetests.model.source.Discount) o;
+ return Objects.equal(startTime, discount.getStartTime()) &&
+ Objects.equal(endTime, discount.getEndTime()) &&
+ Objects.equal(discountPrice, discount.getDiscountPrice());
+ }
+ if(o.getClass() != getClass()) return false;
+ Discount discount = (Discount) o;
+ return Objects.equal(startTime, discount.startTime) &&
+ Objects.equal(endTime, discount.endTime) &&
+ Objects.equal(discountPrice, discount.discountPrice);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(startTime, endTime, discountPrice);
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(String endTime) {
+ this.endTime = endTime;
+ }
+
+ public BigDecimal getDiscountPrice() {
+ return discountPrice;
+ }
+
+ public void setDiscountPrice(BigDecimal discountPrice) {
+ this.discountPrice = discountPrice;
+ }
+
+ public Discount(String startTime, String endTime, BigDecimal discountPrice) {
+
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.discountPrice = discountPrice;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Order.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Order.java
new file mode 100644
index 0000000000..cbce84efc4
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Order.java
@@ -0,0 +1,210 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.google.common.base.Objects;
+import com.googlecode.jmapper.annotations.JMap;
+import com.googlecode.jmapper.annotations.JMapConversion;
+
+import java.util.List;
+public class Order {
+ @JMap
+ private User orderingUser;
+ @JMap
+ private List orderedProducts;
+ @JMap("status")
+ private OrderStatus orderStatus;
+ @JMap
+ private String orderDate;
+ @JMap
+ private String orderFinishDate;
+ @JMap
+ private PaymentType paymentType;
+ @JMap
+ private Discount discount;
+ @JMap
+ private int orderId;
+ @JMap
+ private DeliveryData deliveryData;
+ @JMap
+ private Shop offeringShop;
+
+ public Order() {
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if (o.getClass() == SourceOrder.class) {
+ SourceOrder order =
+ (SourceOrder) o;
+ return Objects.equal(orderingUser, order.getOrderingUser()) &&
+ Objects.equal(orderedProducts, order.getOrderedProducts()) &&
+ orderStatus.ordinal() == order.getStatus().ordinal() &&
+ Objects.equal(orderDate, order.getOrderDate()) &&
+ Objects.equal(orderFinishDate, order.getOrderFinishDate()) &&
+ paymentType.ordinal() == order.getPaymentType().ordinal() &&
+ Objects.equal(discount, order.getDiscount()) &&
+ Objects.equal(deliveryData, order.getDeliveryData());
+ }
+ if (o.getClass() != getClass()) return false;
+ Order order = (Order) o;
+ return Objects.equal(orderingUser, order.orderingUser) &&
+ Objects.equal(orderedProducts, order.orderedProducts) &&
+ orderStatus == order.orderStatus &&
+ Objects.equal(orderDate, order.orderDate) &&
+ Objects.equal(orderFinishDate, order.orderFinishDate) &&
+ paymentType == order.paymentType &&
+ Objects.equal(discount, order.discount) &&
+ Objects.equal(deliveryData, order.deliveryData);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(orderingUser, orderedProducts, orderStatus, orderDate, orderFinishDate, paymentType, discount, deliveryData);
+ }
+
+ public User getOrderingUser() {
+ return orderingUser;
+ }
+
+ public void setOrderingUser(User orderingUser) {
+ this.orderingUser = orderingUser;
+ }
+
+ public List getOrderedProducts() {
+ return orderedProducts;
+ }
+
+ public void setOrderedProducts(List orderedProducts) {
+ this.orderedProducts = orderedProducts;
+ }
+
+ public OrderStatus getOrderStatus() {
+ return orderStatus;
+ }
+
+ public void setOrderStatus(OrderStatus status) {
+ this.orderStatus = status;
+ }
+
+ public String getOrderDate() {
+ return orderDate;
+ }
+
+ public void setOrderDate(String orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ public String getOrderFinishDate() {
+ return orderFinishDate;
+ }
+
+ public void setOrderFinishDate(String orderFinishDate) {
+ this.orderFinishDate = orderFinishDate;
+ }
+
+ public PaymentType getPaymentType() {
+ return paymentType;
+ }
+
+ public void setPaymentType(PaymentType paymentType) {
+ this.paymentType = paymentType;
+ }
+
+ public Discount getDiscount() {
+ return discount;
+ }
+
+ public void setDiscount(Discount discount) {
+ this.discount = discount;
+ }
+
+ public DeliveryData getDeliveryData() {
+ return deliveryData;
+ }
+
+ public void setDeliveryData(DeliveryData deliveryData) {
+ this.deliveryData = deliveryData;
+ }
+
+
+ public int getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(int orderId) {
+ this.orderId = orderId;
+ }
+
+ public Order(User orderingUser, List orderedProducts, OrderStatus orderStatus, String orderDate, String orderFinishDate, PaymentType paymentType, Discount discount, int orderId, DeliveryData deliveryData, Shop offeringShop) {
+
+ this.orderingUser = orderingUser;
+ this.orderedProducts = orderedProducts;
+ this.orderStatus = orderStatus;
+ this.orderDate = orderDate;
+ this.orderFinishDate = orderFinishDate;
+ this.paymentType = paymentType;
+ this.discount = discount;
+ this.orderId = orderId;
+ this.deliveryData = deliveryData;
+ this.offeringShop = offeringShop;
+ }
+
+ public Shop getOfferingShop() {
+ return offeringShop;
+ }
+
+ public void setOfferingShop(Shop offeringShop) {
+ this.offeringShop = offeringShop;
+ }
+
+
+
+ @JMapConversion(from = "status", to = "orderStatus")
+ public OrderStatus conversion(com.baeldung.performancetests.model.source.OrderStatus status) {
+ OrderStatus orderStatus = null;
+ switch(status) {
+ case CREATED:
+ orderStatus = OrderStatus.CREATED;
+ break;
+ case FINISHED:
+ orderStatus = OrderStatus.FINISHED;
+ break;
+
+ case CONFIRMED:
+ orderStatus = OrderStatus.CONFIRMED;
+ break;
+
+ case COLLECTING:
+ orderStatus = OrderStatus.COLLECTING;
+ break;
+
+ case IN_TRANSPORT:
+ orderStatus = OrderStatus.IN_TRANSPORT;
+ break;
+ }
+ return orderStatus;
+ }
+
+ @JMapConversion(from = "paymentType", to = "paymentType")
+ public PaymentType conversion(com.baeldung.performancetests.model.source.PaymentType type) {
+ PaymentType paymentType = null;
+ switch(type) {
+ case CARD:
+ paymentType = PaymentType.CARD;
+ break;
+
+ case CASH:
+ paymentType = PaymentType.CASH;
+ break;
+
+ case TRANSFER:
+ paymentType = PaymentType.TRANSFER;
+ break;
+ }
+ return paymentType;
+ }
+
+
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/OrderStatus.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/OrderStatus.java
new file mode 100644
index 0000000000..48118201e1
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/OrderStatus.java
@@ -0,0 +1,5 @@
+package com.baeldung.performancetests.model.destination;
+
+public enum OrderStatus {
+ CREATED, CONFIRMED, COLLECTING, IN_TRANSPORT, FINISHED
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/PaymentType.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/PaymentType.java
new file mode 100644
index 0000000000..441e275b18
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/PaymentType.java
@@ -0,0 +1,5 @@
+package com.baeldung.performancetests.model.destination;
+
+public enum PaymentType {
+ CASH, CARD, TRANSFER
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Product.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Product.java
new file mode 100644
index 0000000000..bc1e95e2c0
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Product.java
@@ -0,0 +1,107 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.google.common.base.Objects;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.math.BigDecimal;
+
+@JGlobalMap
+public class Product {
+ private BigDecimal price;
+ private int quantity;
+
+ public Product() {
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isAvailable() {
+ return available;
+ }
+
+ public void setAvailable(boolean available) {
+ this.available = available;
+ }
+
+ public RefundPolicy getRefundPolicy() {
+ return refundPolicy;
+ }
+
+ public void setRefundPolicy(RefundPolicy refundPolicy) {
+ this.refundPolicy = refundPolicy;
+ }
+
+ private String name;
+
+ public Product(BigDecimal price, int quantity, String name, String description, boolean available, RefundPolicy refundPolicy) {
+ this.price = price;
+ this.quantity = quantity;
+ this.name = name;
+ this.description = description;
+ this.available = available;
+ this.refundPolicy = refundPolicy;
+ }
+
+ String description;
+ boolean available;
+ private RefundPolicy refundPolicy;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if (o.getClass() == com.baeldung.performancetests.model.source.Product.class) {
+ com.baeldung.performancetests.model.source.Product product =
+ (com.baeldung.performancetests.model.source.Product) o;
+ return quantity == product.getQuantity() &&
+ available == product.isAvailable() &&
+ Objects.equal(price, product.getPrice()) &&
+ Objects.equal(name, product.getName()) &&
+ Objects.equal(description, product.getDescription()) &&
+ Objects.equal(refundPolicy, product.getRefundPolicy());
+ }
+ if(o.getClass() != getClass()) return false;
+ Product product = (Product) o;
+ return quantity == product.quantity &&
+ available == product.available &&
+ Objects.equal(price, product.price) &&
+ Objects.equal(name, product.name) &&
+ Objects.equal(description, product.description) &&
+ Objects.equal(refundPolicy, product.refundPolicy);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(price, quantity, name, description, available, refundPolicy);
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/RefundPolicy.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/RefundPolicy.java
new file mode 100644
index 0000000000..523957596c
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/RefundPolicy.java
@@ -0,0 +1,72 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.google.common.base.Objects;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+import com.googlecode.jmapper.annotations.JMapAccessor;
+
+import java.util.List;
+
+@JGlobalMap
+public class RefundPolicy {
+ @JMapAccessor(get = "isRefundable", set = "setRefundable")
+ private boolean isRefundable;
+ private int refundTimeInDays;
+
+ public RefundPolicy() {
+ }
+
+ public boolean isRefundable() {
+ return isRefundable;
+ }
+
+ public void setRefundable(boolean refundable) {
+ isRefundable = refundable;
+ }
+
+ public int getRefundTimeInDays() {
+ return refundTimeInDays;
+ }
+
+ public void setRefundTimeInDays(int refundTimeInDays) {
+ this.refundTimeInDays = refundTimeInDays;
+ }
+
+ public List getNotes() {
+ return notes;
+ }
+
+ public void setNotes(List notes) {
+ this.notes = notes;
+ }
+
+ public RefundPolicy(boolean isRefundable, int refundTimeInDays, List notes) {
+
+ this.isRefundable = isRefundable;
+ this.refundTimeInDays = refundTimeInDays;
+ this.notes = notes;
+ }
+
+ private List notes;
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if (o.getClass() == com.baeldung.performancetests.model.source.RefundPolicy.class) {
+ com.baeldung.performancetests.model.source.RefundPolicy that = (com.baeldung.performancetests.model.source.RefundPolicy) o;
+ return isRefundable == that.isRefundable() &&
+ refundTimeInDays == that.getRefundTimeInDays() &&
+ Objects.equal(notes, that.getNotes());
+ }
+ if (o.getClass() != getClass()) return false;
+ RefundPolicy that = (RefundPolicy) o;
+ return isRefundable == that.isRefundable &&
+ refundTimeInDays == that.refundTimeInDays &&
+ Objects.equal(notes, that.notes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(isRefundable, refundTimeInDays, notes);
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Review.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Review.java
new file mode 100644
index 0000000000..d1794d4913
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Review.java
@@ -0,0 +1,67 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.baeldung.performancetests.model.source.User;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+@JGlobalMap
+public class Review {
+
+ int shippingGrade;
+ int pricingGrade;
+ int serviceGrade;
+ User reviewingUser;
+ String note;
+
+ public int getShippingGrade() {
+ return shippingGrade;
+ }
+
+ public void setShippingGrade(int shippingGrade) {
+ this.shippingGrade = shippingGrade;
+ }
+
+ public int getPricingGrade() {
+ return pricingGrade;
+ }
+
+ public void setPricingGrade(int pricingGrade) {
+ this.pricingGrade = pricingGrade;
+ }
+
+ public int getServiceGrade() {
+ return serviceGrade;
+ }
+
+ public void setServiceGrade(int serviceGrade) {
+ this.serviceGrade = serviceGrade;
+ }
+
+ public User getReviewingUser() {
+ return reviewingUser;
+ }
+
+ public void setReviewingUser(User reviewingUser) {
+ this.reviewingUser = reviewingUser;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public Review() {
+
+ }
+
+ public Review(int shippingGrade, int pricingGrade, int serviceGrade, User reviewingUser, String note) {
+
+ this.shippingGrade = shippingGrade;
+ this.pricingGrade = pricingGrade;
+ this.serviceGrade = serviceGrade;
+ this.reviewingUser = reviewingUser;
+ this.note = note;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Shop.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Shop.java
new file mode 100644
index 0000000000..75f37b8bba
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/Shop.java
@@ -0,0 +1,57 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.baeldung.performancetests.model.source.Address;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.util.List;
+@JGlobalMap
+public class Shop {
+
+ private String shopName;
+ private Address shopAddres;
+ private String shopUrl;
+ private List reviews;
+
+ public String getShopName() {
+ return shopName;
+ }
+
+ public void setShopName(String shopName) {
+ this.shopName = shopName;
+ }
+
+ public Address getShopAddres() {
+ return shopAddres;
+ }
+
+ public void setShopAddres(Address shopAddres) {
+ this.shopAddres = shopAddres;
+ }
+
+ public String getShopUrl() {
+ return shopUrl;
+ }
+
+ public void setShopUrl(String shopUrl) {
+ this.shopUrl = shopUrl;
+ }
+
+ public Shop() {
+ }
+
+ public List getReviews() {
+ return reviews;
+ }
+
+ public void setReviews(List reviews) {
+ this.reviews = reviews;
+ }
+
+ public Shop(String shopName, Address shopAddres, String shopUrl, List reviews) {
+
+ this.shopName = shopName;
+ this.shopAddres = shopAddres;
+ this.shopUrl = shopUrl;
+ this.reviews = reviews;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/User.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/User.java
new file mode 100644
index 0000000000..6f604f64b3
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/destination/User.java
@@ -0,0 +1,87 @@
+package com.baeldung.performancetests.model.destination;
+
+import com.google.common.base.Objects;
+import com.googlecode.jmapper.annotations.JGlobalMap;
+import com.googlecode.jmapper.annotations.JMapConversion;
+
+@JGlobalMap
+public class User {
+ private String username;
+ private String email;
+ private AccountStatus userAccountStatus;
+
+ public User(String username, String email, AccountStatus userAccountStatus) {
+ this.username = username;
+ this.email = email;
+ this.userAccountStatus = userAccountStatus;
+ }
+
+ public User() {
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public AccountStatus getUserAccountStatus() {
+ return userAccountStatus;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null) return false;
+ if (o.getClass() == com.baeldung.performancetests.model.source.User.class) {
+ com.baeldung.performancetests.model.source.User user =
+ (com.baeldung.performancetests.model.source.User) o;
+ return Objects.equal(username, user.getUsername()) &&
+ Objects.equal(email, user.getEmail()) &&
+ userAccountStatus.ordinal() == user.getUserAccountStatus().ordinal();
+ }
+ if (o.getClass() != getClass()) return false;
+ User user = (User) o;
+ return Objects.equal(username, user.username) &&
+ Objects.equal(email, user.email) &&
+ userAccountStatus == user.userAccountStatus;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(username, email, userAccountStatus);
+ }
+
+ public void setUserAccountStatus(AccountStatus userAccountStatus) {
+ this.userAccountStatus = userAccountStatus;
+ }
+
+
+ @JMapConversion(from = "userAccountStatus", to = "userAccountStatus")
+ public AccountStatus conversion(com.baeldung.performancetests.model.source.AccountStatus status) {
+ AccountStatus accountStatus = null;
+ switch(status) {
+ case ACTIVE:
+ accountStatus = AccountStatus.ACTIVE;
+ break;
+ case NOT_ACTIVE:
+ accountStatus = AccountStatus.NOT_ACTIVE;
+ break;
+
+ case BANNED:
+ accountStatus = AccountStatus.BANNED;
+ break;
+ }
+ return accountStatus;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/AccountStatus.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/AccountStatus.java
new file mode 100644
index 0000000000..e3e7d7964c
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/AccountStatus.java
@@ -0,0 +1,7 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+public enum AccountStatus {
+ ACTIVE, NOT_ACTIVE, BANNED
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Address.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Address.java
new file mode 100644
index 0000000000..2818fa0065
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Address.java
@@ -0,0 +1,54 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+public class Address {
+ private String street;
+ private String city;
+ private String postalCode;
+
+ public Address() {
+ }
+
+ private String country;
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String street) {
+ this.street = street;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String country) {
+ this.country = country;
+ }
+
+ public Address(String street, String city, String postalCode, String country) {
+
+ this.street = street;
+ this.city = city;
+ this.postalCode = postalCode;
+ this.country = country;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/DeliveryData.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/DeliveryData.java
new file mode 100644
index 0000000000..9501649a05
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/DeliveryData.java
@@ -0,0 +1,54 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+import com.googlecode.jmapper.annotations.JMapAccessor;
+
+public class DeliveryData {
+ private Address deliveryAddress;
+ @JMapAccessor(get = "isPrePaid", set = "setPrePaid")
+ private boolean isPrePaid;
+ private String trackingCode;
+ private int expectedDeliveryTimeInDays;
+
+ public DeliveryData() {
+ }
+
+ public Address getDeliveryAddress() {
+ return deliveryAddress;
+ }
+
+ public void setDeliveryAddress(Address deliveryAddress) {
+ this.deliveryAddress = deliveryAddress;
+ }
+
+ public boolean isPrePaid() {
+ return isPrePaid;
+ }
+
+ public void setPrePaid(boolean prePaid) {
+ isPrePaid = prePaid;
+ }
+
+ public String getTrackingCode() {
+ return trackingCode;
+ }
+
+ public void setTrackingCode(String trackingCode) {
+ this.trackingCode = trackingCode;
+ }
+
+ public int getExpectedDeliveryTimeInDays() {
+ return expectedDeliveryTimeInDays;
+ }
+
+ public void setExpectedDeliveryTimeInDays(int expectedDeliveryTimeInDays) {
+ this.expectedDeliveryTimeInDays = expectedDeliveryTimeInDays;
+ }
+
+ public DeliveryData(Address deliveryAddress, boolean isPrePaid, String trackingCode, int expectedDeliveryTimeInDays) {
+ this.deliveryAddress = deliveryAddress;
+ this.isPrePaid = isPrePaid;
+ this.trackingCode = trackingCode;
+ this.expectedDeliveryTimeInDays = expectedDeliveryTimeInDays;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Discount.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Discount.java
new file mode 100644
index 0000000000..603432dfed
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Discount.java
@@ -0,0 +1,44 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.math.BigDecimal;
+public class Discount {
+ private String startTime;
+ private String endTime;
+ private BigDecimal discountPrice;
+
+ public Discount() {
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public String getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(String endTime) {
+ this.endTime = endTime;
+ }
+
+ public BigDecimal getDiscountPrice() {
+ return discountPrice;
+ }
+
+ public void setDiscountPrice(BigDecimal discountPrice) {
+ this.discountPrice = discountPrice;
+ }
+
+ public Discount(String startTime, String endTime, BigDecimal discountPrice) {
+
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.discountPrice = discountPrice;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/OrderStatus.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/OrderStatus.java
new file mode 100644
index 0000000000..962c91a6c4
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/OrderStatus.java
@@ -0,0 +1,7 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+public enum OrderStatus {
+ CREATED, CONFIRMED, COLLECTING, IN_TRANSPORT, FINISHED
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/PaymentType.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/PaymentType.java
new file mode 100644
index 0000000000..fbb4c82afc
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/PaymentType.java
@@ -0,0 +1,7 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+public enum PaymentType {
+ CASH, CARD, TRANSFER
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Product.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Product.java
new file mode 100644
index 0000000000..5feccb97dc
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Product.java
@@ -0,0 +1,76 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+import java.math.BigDecimal;
+
+public class Product {
+ private BigDecimal price;
+ private int quantity;
+
+ public Product() {
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public boolean isAvailable() {
+ return available;
+ }
+
+ public void setAvailable(boolean available) {
+ this.available = available;
+ }
+
+ public RefundPolicy getRefundPolicy() {
+ return refundPolicy;
+ }
+
+ public void setRefundPolicy(RefundPolicy refundPolicy) {
+ this.refundPolicy = refundPolicy;
+ }
+
+ private String name;
+
+ public Product(BigDecimal price, int quantity, String name, String description, boolean available, RefundPolicy refundPolicy) {
+ this.price = price;
+ this.quantity = quantity;
+ this.name = name;
+ this.description = description;
+ this.available = available;
+ this.refundPolicy = refundPolicy;
+ }
+
+ String description;
+ boolean available;
+ private RefundPolicy refundPolicy;
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/RefundPolicy.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/RefundPolicy.java
new file mode 100644
index 0000000000..5111e27b54
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/RefundPolicy.java
@@ -0,0 +1,48 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+import com.googlecode.jmapper.annotations.JMapAccessor;
+
+import java.util.List;
+
+public class RefundPolicy {
+ @JMapAccessor(get = "isRefundable", set = "setRefundable")
+ private boolean isRefundable;
+ private int refundTimeInDays;
+
+ public RefundPolicy() {
+ }
+
+ public boolean isRefundable() {
+ return isRefundable;
+ }
+
+ public void setRefundable(boolean refundable) {
+ isRefundable = refundable;
+ }
+
+ public int getRefundTimeInDays() {
+ return refundTimeInDays;
+ }
+
+ public void setRefundTimeInDays(int refundTimeInDays) {
+ this.refundTimeInDays = refundTimeInDays;
+ }
+
+ public List getNotes() {
+ return notes;
+ }
+
+ public void setNotes(List notes) {
+ this.notes = notes;
+ }
+
+ public RefundPolicy(boolean isRefundable, int refundTimeInDays, List notes) {
+
+ this.isRefundable = isRefundable;
+ this.refundTimeInDays = refundTimeInDays;
+ this.notes = notes;
+ }
+
+ private List notes;
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Review.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Review.java
new file mode 100644
index 0000000000..8e2630b672
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Review.java
@@ -0,0 +1,63 @@
+package com.baeldung.performancetests.model.source;
+
+public class Review {
+
+ int shippingGrade;
+ int pricingGrade;
+ int serviceGrade;
+ User reviewingUser;
+ String note;
+
+ public int getShippingGrade() {
+ return shippingGrade;
+ }
+
+ public void setShippingGrade(int shippingGrade) {
+ this.shippingGrade = shippingGrade;
+ }
+
+ public int getPricingGrade() {
+ return pricingGrade;
+ }
+
+ public void setPricingGrade(int pricingGrade) {
+ this.pricingGrade = pricingGrade;
+ }
+
+ public int getServiceGrade() {
+ return serviceGrade;
+ }
+
+ public void setServiceGrade(int serviceGrade) {
+ this.serviceGrade = serviceGrade;
+ }
+
+ public User getReviewingUser() {
+ return reviewingUser;
+ }
+
+ public void setReviewingUser(User reviewingUser) {
+ this.reviewingUser = reviewingUser;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public Review() {
+
+ }
+
+ public Review(int shippingGrade, int pricingGrade, int serviceGrade, User reviewingUser, String note) {
+
+ this.shippingGrade = shippingGrade;
+ this.pricingGrade = pricingGrade;
+ this.serviceGrade = serviceGrade;
+ this.reviewingUser = reviewingUser;
+ this.note = note;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Shop.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Shop.java
new file mode 100644
index 0000000000..d35681933b
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/Shop.java
@@ -0,0 +1,55 @@
+package com.baeldung.performancetests.model.source;
+
+import java.util.List;
+
+public class Shop {
+
+ private String shopName;
+ private Address shopAddres;
+
+ public String getShopName() {
+ return shopName;
+ }
+
+ public void setShopName(String shopName) {
+ this.shopName = shopName;
+ }
+
+ public Address getShopAddres() {
+ return shopAddres;
+ }
+
+ public void setShopAddres(Address shopAddres) {
+ this.shopAddres = shopAddres;
+ }
+
+ public Shop() {
+ }
+
+ public String getShopUrl() {
+ return shopUrl;
+ }
+
+ public void setShopUrl(String shopUrl) {
+ this.shopUrl = shopUrl;
+ }
+
+ public List getReviews() {
+ return reviews;
+ }
+
+ public void setReviews(List reviews) {
+ this.reviews = reviews;
+ }
+
+ public Shop(String shopName, Address shopAddres, String shopUrl, List reviews) {
+
+ this.shopName = shopName;
+ this.shopAddres = shopAddres;
+ this.shopUrl = shopUrl;
+ this.reviews = reviews;
+ }
+
+ private String shopUrl;
+ private List reviews;
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceCode.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceCode.java
new file mode 100644
index 0000000000..52934d6e0b
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceCode.java
@@ -0,0 +1,22 @@
+package com.baeldung.performancetests.model.source;
+
+public class SourceCode {
+ String code;
+
+ public SourceCode() {
+ }
+
+ public String getCode() {
+
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public SourceCode(String code) {
+
+ this.code = code;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceOrder.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceOrder.java
new file mode 100644
index 0000000000..e83a145f6f
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/SourceOrder.java
@@ -0,0 +1,118 @@
+package com.baeldung.performancetests.model.source;
+
+
+import java.util.List;
+public class SourceOrder {
+ private String orderFinishDate;
+ private PaymentType paymentType;
+ private Discount discount;
+ private DeliveryData deliveryData;
+ private User orderingUser;
+ private List orderedProducts;
+ private Shop offeringShop;
+ private int orderId;
+ private OrderStatus status;
+ private String orderDate;
+ public SourceOrder() {
+ }
+
+ public User getOrderingUser() {
+ return orderingUser;
+ }
+
+ public void setOrderingUser(User orderingUser) {
+ this.orderingUser = orderingUser;
+ }
+
+ public List getOrderedProducts() {
+ return orderedProducts;
+ }
+
+ public void setOrderedProducts(List orderedProducts) {
+ this.orderedProducts = orderedProducts;
+ }
+
+ public OrderStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(OrderStatus status) {
+ this.status = status;
+ }
+
+ public String getOrderDate() {
+ return orderDate;
+ }
+
+ public void setOrderDate(String orderDate) {
+ this.orderDate = orderDate;
+ }
+
+ public String getOrderFinishDate() {
+ return orderFinishDate;
+ }
+
+ public void setOrderFinishDate(String orderFinishDate) {
+ this.orderFinishDate = orderFinishDate;
+ }
+
+ public PaymentType getPaymentType() {
+ return paymentType;
+ }
+
+ public void setPaymentType(PaymentType paymentType) {
+ this.paymentType = paymentType;
+ }
+
+ public Discount getDiscount() {
+ return discount;
+ }
+
+ public void setDiscount(Discount discount) {
+ this.discount = discount;
+ }
+
+ public DeliveryData getDeliveryData() {
+ return deliveryData;
+ }
+
+ public void setDeliveryData(DeliveryData deliveryData) {
+ this.deliveryData = deliveryData;
+ }
+
+ public Shop getOfferingShop() {
+ return offeringShop;
+ }
+
+ public void setOfferingShop(Shop offeringShop) {
+ this.offeringShop = offeringShop;
+ }
+
+
+
+
+
+ public int getOrderId() {
+ return orderId;
+ }
+
+ public void setOrderId(int orderId) {
+ this.orderId = orderId;
+ }
+
+ public SourceOrder(OrderStatus status, String orderDate, String orderFinishDate, PaymentType paymentType, Discount discount, DeliveryData deliveryData, User orderingUser, List orderedProducts, Shop offeringShop, int orderId) {
+
+ this.status = status;
+ this.orderDate = orderDate;
+ this.orderFinishDate = orderFinishDate;
+ this.paymentType = paymentType;
+ this.discount = discount;
+ this.deliveryData = deliveryData;
+ this.orderingUser = orderingUser;
+ this.orderedProducts = orderedProducts;
+ this.offeringShop = offeringShop;
+ this.orderId = orderId;
+ }
+
+
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/model/source/User.java b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/User.java
new file mode 100644
index 0000000000..8c50acb560
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/model/source/User.java
@@ -0,0 +1,42 @@
+package com.baeldung.performancetests.model.source;
+
+import com.googlecode.jmapper.annotations.JGlobalMap;
+
+public class User {
+ private String username;
+ private String email;
+ private AccountStatus userAccountStatus;
+
+ public User(String username, String email, AccountStatus userAccountStatus) {
+ this.username = username;
+ this.email = email;
+ this.userAccountStatus = userAccountStatus;
+ }
+
+ public User() {
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public AccountStatus getUserAccountStatus() {
+ return userAccountStatus;
+ }
+
+ public void setUserAccountStatus(AccountStatus userAccountStatus) {
+ this.userAccountStatus = userAccountStatus;
+ }
+}
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/modelmapper/ModelMapperConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/modelmapper/ModelMapperConverter.java
new file mode 100644
index 0000000000..e3f0426e39
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/modelmapper/ModelMapperConverter.java
@@ -0,0 +1,26 @@
+package com.baeldung.performancetests.modelmapper;
+
+import com.baeldung.performancetests.Converter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+import org.modelmapper.ModelMapper;
+
+ public class ModelMapperConverter implements Converter {
+ private ModelMapper modelMapper;
+
+ public ModelMapperConverter() {
+ modelMapper = new ModelMapper();
+ }
+
+ @Override
+ public Order convert(SourceOrder sourceOrder) {
+ return modelMapper.map(sourceOrder, Order.class);
+ }
+
+ @Override
+ public DestinationCode convert(SourceCode sourceCode) {
+ return modelMapper.map(sourceCode, DestinationCode.class);
+ }
+ }
diff --git a/performance-tests/src/main/java/com/baeldung/performancetests/orika/OrikaConverter.java b/performance-tests/src/main/java/com/baeldung/performancetests/orika/OrikaConverter.java
new file mode 100644
index 0000000000..994a1830d5
--- /dev/null
+++ b/performance-tests/src/main/java/com/baeldung/performancetests/orika/OrikaConverter.java
@@ -0,0 +1,31 @@
+package com.baeldung.performancetests.orika;
+
+import com.baeldung.performancetests.Converter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.SourceCode;
+import com.baeldung.performancetests.model.source.SourceOrder;
+import com.baeldung.performancetests.model.destination.Order;
+import ma.glasnost.orika.MapperFacade;
+import ma.glasnost.orika.MapperFactory;
+import ma.glasnost.orika.impl.DefaultMapperFactory;
+
+public class OrikaConverter implements Converter{
+ private MapperFacade mapperFacade;
+
+ public OrikaConverter() {
+ MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
+
+ mapperFactory.classMap(Order.class, SourceOrder.class).field("orderStatus", "status").byDefault().register();
+ mapperFacade = mapperFactory.getMapperFacade();
+ }
+
+ @Override
+ public Order convert(SourceOrder sourceOrder) {
+ return mapperFacade.map(sourceOrder, Order.class);
+ }
+
+ @Override
+ public DestinationCode convert(SourceCode sourceCode) {
+ return mapperFacade.map(sourceCode, DestinationCode.class);
+ }
+}
diff --git a/performance-tests/src/main/resources/dozer-mapping.xml b/performance-tests/src/main/resources/dozer-mapping.xml
new file mode 100644
index 0000000000..7fd7e78e9f
--- /dev/null
+++ b/performance-tests/src/main/resources/dozer-mapping.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ true
+ MM/dd/yyyy HH:mm
+ true
+
+
+
+ com.baeldung.performancetests.model.source.SourceOrder
+ com.baeldung.performancetests.model.destination.Order
+
+ status
+ orderStatus
+
+
+
+ com.baeldung.performancetests.model.source.SourceCode
+ com.baeldung.performancetests.model.destination.DestinationCode
+
+
\ No newline at end of file
diff --git a/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java b/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java
new file mode 100644
index 0000000000..9a45f032a6
--- /dev/null
+++ b/performance-tests/src/test/java/com/baeldung/performancetests/benchmark/MappingFrameworksPerformance.java
@@ -0,0 +1,193 @@
+package com.baeldung.performancetests.benchmark;
+
+import com.baeldung.performancetests.dozer.DozerConverter;
+import com.baeldung.performancetests.jmapper.JMapperConverter;
+import com.baeldung.performancetests.mapstruct.MapStructConverter;
+import com.baeldung.performancetests.model.destination.DestinationCode;
+import com.baeldung.performancetests.model.source.*;
+import com.baeldung.performancetests.model.destination.Order;
+import com.baeldung.performancetests.modelmapper.ModelMapperConverter;
+import com.baeldung.performancetests.orika.OrikaConverter;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openjdk.jmh.annotations.*;
+import org.openjdk.jmh.runner.RunnerException;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+@State(Scope.Group)
+public class MappingFrameworksPerformance {
+ SourceOrder sourceOrder = null;
+ SourceCode sourceCode = null;
+ @Setup
+ public void setUp() {
+ User user = new User("John", "John@doe.com", AccountStatus.ACTIVE);
+ RefundPolicy refundPolicy = new RefundPolicy(true, 30, Collections.singletonList("Refundable only if not used!"));
+
+ Product product = new Product(BigDecimal.valueOf(10.99),
+ 100,
+ "Sample Product",
+ "Sample Product to be sold",
+ true,
+ refundPolicy
+ );
+
+ Discount discount = new Discount(Instant.now().toString(), Instant.now().toString(), BigDecimal.valueOf(5.99));
+ Address deliveryAddress = new Address("Washington Street 5", "New York", "55045", "USA");
+ DeliveryData deliveryData = new DeliveryData(deliveryAddress, true, "", 10);
+ Address shopAddress = new Address("Roosvelt Street 9", "Boston", "55042", "USA");
+ User reviewingUser = new User("John", "Johhny@John.com", AccountStatus.ACTIVE);
+ User negativeReviewingUser = new User("Carl", "Carl@Coral.com", AccountStatus.ACTIVE);
+ Review review = new Review(5, 5, 5, reviewingUser, "The best shop I've ever bought things in");
+
+ Review negativeReview = new Review(1, 1, 1, negativeReviewingUser, "I will never buy anything again here!");
+
+ List reviewList = new ArrayList<>();
+ reviewList.add(review);
+ reviewList.add(negativeReview);
+ Shop shop = new Shop("Super Shop", shopAddress,"www.super-shop.com",reviewList);
+
+ sourceOrder = new SourceOrder(OrderStatus.CONFIRMED,
+ Instant.now().toString(),
+ Instant.MAX.toString(),
+ PaymentType.TRANSFER,
+ discount,
+ deliveryData,
+ user,
+ Collections.singletonList(product),
+ shop,
+ 1
+ );
+
+ sourceCode = new SourceCode("This is source code!");
+ }
+
+
+ public void main(String[] args) throws IOException, RunnerException {
+ org.openjdk.jmh.Main.main(args);
+ }
+
+
+ @Benchmark
+ @Group("realLifeTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void orikaMapperRealLifeBenchmark() {
+ OrikaConverter orikaConverter = new OrikaConverter();
+ Order mappedOrder = orikaConverter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+
+ }
+
+ @Benchmark
+ @Group("realLifeTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void jmapperRealLifeBenchmark() {
+ JMapperConverter jmapperConverter = new JMapperConverter();
+ Order mappedOrder = jmapperConverter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+ }
+
+ @Benchmark
+ @Group("realLifeTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void modelMapperRealLifeBenchmark() {
+ ModelMapperConverter modelMapperConverter = new ModelMapperConverter();
+ Order mappedOrder = modelMapperConverter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+ }
+
+
+ @Benchmark
+ @Group("realLifeTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void dozerMapperRealLifeBenchmark() {
+ DozerConverter dozerConverter = new DozerConverter();
+ Order mappedOrder = dozerConverter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+
+ }
+
+ @Benchmark
+ @Group("realLifeTest")
+ @Fork(value = 1, warmups = 1)
+ @BenchmarkMode(Mode.All)
+ public void mapStructRealLifeMapperBenchmark() {
+ MapStructConverter converter = MapStructConverter.MAPPER;
+ Order mappedOrder = converter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+ }
+
+ @Benchmark
+ @Group("simpleTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void orikaMapperSimpleBenchmark() {
+ OrikaConverter orikaConverter = new OrikaConverter();
+ DestinationCode mappedCode = orikaConverter.convert(sourceCode);
+ Assert.assertEquals(mappedCode.getCode(), sourceCode.getCode());
+
+ }
+
+ @Benchmark
+ @Group("simpleTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void jmapperSimpleBenchmark() {
+ JMapperConverter jmapperConverter = new JMapperConverter();
+ DestinationCode mappedCode = jmapperConverter.convert(sourceCode);
+ Assert.assertEquals(mappedCode.getCode(), sourceCode.getCode());
+ }
+
+ @Benchmark
+ @Group("simpleTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void modelMapperBenchmark() {
+ ModelMapperConverter modelMapperConverter = new ModelMapperConverter();
+ DestinationCode mappedCode = modelMapperConverter.convert(sourceCode);
+ Assert.assertEquals(mappedCode.getCode(), sourceCode.getCode());
+ }
+
+
+ @Benchmark
+ @Group("simpleTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void dozerMapperSimpleBenchmark() {
+ DozerConverter dozerConverter = new DozerConverter();
+ Order mappedOrder = dozerConverter.convert(sourceOrder);
+ Assert.assertEquals(mappedOrder, sourceOrder);
+
+ }
+
+ @Benchmark
+ @Group("simpleTest")
+ @Fork(value = 1, warmups = 1)
+ @OutputTimeUnit(TimeUnit.MILLISECONDS)
+ @BenchmarkMode(Mode.All)
+ public void mapStructMapperSimpleBenchmark() {
+ MapStructConverter converter = MapStructConverter.MAPPER;
+ DestinationCode mappedCode = converter.convert(sourceCode);
+ Assert.assertEquals(mappedCode.getCode(), sourceCode.getCode());
+ }
+
+
+}
diff --git a/performance-tests/src/test/resources/dozer-mapping.xml b/performance-tests/src/test/resources/dozer-mapping.xml
new file mode 100644
index 0000000000..7484812431
--- /dev/null
+++ b/performance-tests/src/test/resources/dozer-mapping.xml
@@ -0,0 +1,21 @@
+
+
+
+
+ true
+ MM/dd/yyyy HH:mm
+ true
+
+
+
+ com.baeldung.performancetests.model.source.SourceOrder
+ com.baeldung.performancetests.model.destination.Order
+
+ status
+ orderStatus
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 3ba6b0c8df..78e0fa925e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -256,6 +256,7 @@
persistence-modules/java-jdbi
jersey
java-spi
+ performance-tests