3434import com .cloud .host .HostVO ;
3535import com .cloud .host .dao .HostDao ;
3636import com .cloud .host .dao .HostDaoImpl ;
37+ import com .cloud .network .IPAddressVO ;
3738import com .cloud .network .dao .IPAddressDao ;
3839import com .cloud .network .dao .IPAddressDaoImpl ;
3940import 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