mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	2) Added new config parameter 'allow.subdomain.network.access' - default value is true. If it's set to false, the child domain can't use the network of the parent domain
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package com.cloud.network.dao;
 | |
| 
 | |
| import java.util.ArrayList;
 | |
| import java.util.List;
 | |
| 
 | |
| import junit.framework.TestCase;
 | |
| 
 | |
| import com.cloud.network.Network.GuestIpType;
 | |
| import com.cloud.network.NetworkVO;
 | |
| import com.cloud.network.Networks.BroadcastDomainType;
 | |
| import com.cloud.network.Networks.Mode;
 | |
| import com.cloud.network.Networks.TrafficType;
 | |
| import com.cloud.utils.component.ComponentLocator;
 | |
| 
 | |
| 
 | |
| public class NetworkDaoTest extends TestCase {
 | |
|     public void testTags() {
 | |
|         NetworkDaoImpl dao = ComponentLocator.inject(NetworkDaoImpl.class);
 | |
|         
 | |
|         dao.expunge(1001l);
 | |
|         NetworkVO network = new NetworkVO(1001, TrafficType.Control, GuestIpType.Direct, Mode.Dhcp, BroadcastDomainType.Native, 1, 1, 1, 1, 1001, "Name", "DisplayText", false, true, null);
 | |
|         network.setGuruName("guru_name");
 | |
|         List<String> tags = new ArrayList<String>();
 | |
| 
 | |
|         tags.add("a");
 | |
|         tags.add("b");
 | |
|         network.setTags(tags);
 | |
| 
 | |
|         network = dao.persist(network);
 | |
|         List<String> saveTags = network.getTags();
 | |
|         assert(saveTags.size() == 2 && saveTags.contains("a") && saveTags.contains("b"));
 | |
| 
 | |
|         NetworkVO retrieved = dao.findById(1001l);
 | |
|         List<String> retrievedTags = retrieved.getTags();
 | |
|         assert(retrievedTags.size() == 2 && retrievedTags.contains("a") && retrievedTags.contains("b"));
 | |
|         
 | |
|         List<String> updateTags = new ArrayList<String>();
 | |
|         updateTags.add("e");
 | |
|         updateTags.add("f");
 | |
|         retrieved.setTags(updateTags);
 | |
|         dao.update(retrieved.getId(), retrieved);
 | |
|         
 | |
|         retrieved = dao.findById(1001l);
 | |
|         retrievedTags = retrieved.getTags();
 | |
|         assert(retrievedTags.size() == 2 && retrievedTags.contains("e") && retrievedTags.contains("f"));
 | |
|         
 | |
|         
 | |
|         dao.expunge(1001l);
 | |
|     }
 | |
|     
 | |
|     public void testListBy() {
 | |
|         NetworkDaoImpl dao = ComponentLocator.inject(NetworkDaoImpl.class);
 | |
|         
 | |
|         dao.listBy(1l, 1l, 1l, "192.168.192.0/24");
 | |
|     }
 | |
| 
 | |
| }
 |