<commit_before>package com.cloud.network.dao;

import java.util.ArrayList;
import java.util.List;

import junit.framework.Assert;
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, true);
        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.assertTrue(saveTags.size() == 2 && saveTags.contains("a") && saveTags.contains("b"));

        NetworkVO retrieved = dao.findById(1001l);
        List<String> retrievedTags = retrieved.getTags();
        Assert.assertTrue(retrievedTags.size() == 2 && retrievedTags.contains("a") && retrievedTags.contains("b"));
        
        List<String> updateTags = new ArrayList<String>();
        updateTags.add("e");
        updateTags.add("f");
        retrieved.setTags(updateTags);<commit_msg>Fix compile issue in test code<commit_after>package com.cloud.network.dao;

import java.util.ArrayList;
import java.util.List;

import junit.framework.Assert;
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, 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.assertTrue(saveTags.size() == 2 && saveTags.contains("a") && saveTags.contains("b"));

        NetworkVO retrieved = dao.findById(1001l);
        List<String> retrievedTags = retrieved.getTags();
        Assert.assertTrue(retrievedTags.size() == 2 && retrievedTags.contains("a") && retrievedTags.contains("b"));
        
        List<String> updateTags = new ArrayList<String>();
        updateTags.add("e");
        updateTags.add("f");
        retrieved.setTags(updateTags);
{'fraction_non_alphanumeric': 0.13293712855802314, 'fraction_numerical': 0.01376290272130122, 'mean_word_length': 3.723781388478582, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7585231', 'n_tokens_mistral': 990, 'n_tokens_neox': 939, 'n_words': 177}