[vlma-devel] commit: Ensure order name unicity. (Adrien Grand )
git version control
git at videolan.org
Sun Nov 9 02:54:23 CET 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sun Nov 9 02:51:52 2008 +0100| [e418d2a90bce2ee4e67bdc1a21db69551633c9d6] | committer: Adrien Grand
Ensure order name unicity.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=e418d2a90bce2ee4e67bdc1a21db69551633c9d6
---
.../main/java/org/videolan/vlma/model/Order.java | 4 ++--
.../java/org/videolan/vlma/model/OrderTest.java | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/vlma-api/src/main/java/org/videolan/vlma/model/Order.java b/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
index b17d17c..b527e32 100644
--- a/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
+++ b/vlma-api/src/main/java/org/videolan/vlma/model/Order.java
@@ -97,9 +97,9 @@ public class Order implements Comparable<Order> {
*/
public String getName() {
if(adapter.getCapacity() <= 1) {
- return "order-" + adapter.getName();
+ return adapter.getServer().getName() + "-" + adapter.getName();
} else {
- return "order-" + adapter.getName() + "-"
+ return adapter.getServer().getName() + "-" + adapter.getName() + "-"
+ (medias.isEmpty() ? "null" : medias.get(0).getId());
}
}
diff --git a/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java b/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
index 0096611..4481844 100644
--- a/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
+++ b/vlma-api/src/test/java/org/videolan/vlma/model/OrderTest.java
@@ -44,6 +44,7 @@ public class OrderTest {
group2.add(media1);
Adapter adapter = new DVBTAdapter();
Server server = new Server();
+ server.setName("server");
server.setIp(InetAddress.getLocalHost());
adapter.setName("adapter");
adapter.setServer(server);
@@ -69,6 +70,9 @@ public class OrderTest {
g2.add(m2);
Adapter a = new FilesAdapter();
a.setName("adapter");
+ Server server = new Server();
+ server.setName("server");
+ a.setServer(server);
order = new Order(a, g1);
Order order2 = new Order(a, g2);
assertTrue(order.equals(order2));
More information about the vlma-devel
mailing list