package org.ovirt.engine.core.bll;

import org.junit.Test;
import org.ovirt.engine.core.common.action.VdcActionType;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import static org.junit.Assert.assertTrue;

public class VdcActionTypeTest {
    private static final int bitsetSize = 5000;

    @Test
    public void testAuditLogTypeValueUniqueness() {
        BitSet bitset = new BitSet(bitsetSize);
        Set<Integer> nonUniqueValues = new TreeSet<Integer>();

        for (VdcActionType vat : VdcActionType.values()) {
            if (bitset.get(vat.getValue())) {
                nonUniqueValues.add(vat.getValue());
            }
            else {
                bitset.set(vat.getValue());
            }
        }
        assertTrue("VdcActionType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty());
    }

    @Test
    public void testCommandClassExistance() {
        List<VdcActionType> missingCommands = new ArrayList<>();
        for (VdcActionType vat : VdcActionType.values()) {
            if (vat != VdcActionType.Unknown) {
                if (CommandsFactory.getCommandClass(vat.name()) == null){
                    missingCommands.add(vat);
                }
            }
        }
        assertTrue("VdcActionType contains the following values that does not correspond to an existing command class: " + missingCommands,
                missingCommands.isEmpty());
    }
}

@@ -345,17 +345,17 @@
  int bit
-s
+S
 etSize =
@@ -462,17 +462,17 @@
 tSet(bit
-s
+S
 etSize);
@@ -974,17 +974,17 @@
 assExist
-a
+e
 nce() %7B%0A

fix typos in test.