Skip to content

Commit bb5d00f

Browse files
author
Kelven Yang
committed
Fix test code broken by changes in IPAddressDao
1 parent cd85135 commit bb5d00f

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

server/test/com/cloud/async/TestAsyncJobManager.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.cloud.host.HostVO;
3535
import com.cloud.host.dao.HostDao;
3636
import com.cloud.host.dao.HostDaoImpl;
37+
import com.cloud.network.IPAddressVO;
3738
import com.cloud.network.dao.IPAddressDao;
3839
import com.cloud.network.dao.IPAddressDaoImpl;
3940
import com.cloud.server.ManagementServer;
@@ -116,11 +117,11 @@ public void run() {
116117
} catch (InterruptedException e) {
117118
}
118119
}
119-
120+
120121
public void ipAssignment() {
121122
final IPAddressDao ipAddressDao = new IPAddressDaoImpl();
122123

123-
final ConcurrentHashMap<String, String> map = new ConcurrentHashMap<String, String>();
124+
final ConcurrentHashMap<String, IPAddressVO> map = new ConcurrentHashMap<String, IPAddressVO>();
124125
//final Map<String, String> map = Collections.synchronizedMap(hashMap);
125126

126127
s_count = 0;
@@ -133,10 +134,10 @@ public void run() {
133134

134135
Transaction txn = Transaction.open("Alex1");
135136
try {
136-
String addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
137-
String returnStr = map.put(addr, addr);
137+
IPAddressVO addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
138+
IPAddressVO returnStr = map.put(addr.getAddress(), addr);
138139
if(returnStr != null) {
139-
System.out.println("addr : " + addr);
140+
System.out.println("addr : " + addr.getAddress());
140141
}
141142
Assert.assertTrue(returnStr == null);
142143
} finally {
@@ -153,8 +154,8 @@ public void run() {
153154

154155
Transaction txn = Transaction.open("Alex2");
155156
try {
156-
String addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
157-
Assert.assertTrue(map.put(addr, addr) == null);
157+
IPAddressVO addr = ipAddressDao.assignIpAddress(1, 0, 1, false);
158+
Assert.assertTrue(map.put(addr.getAddress(), addr) == null);
158159
} finally {
159160
txn.close();
160161
}

0 commit comments

Comments
 (0)