<commit_before>/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 *
 *  Authors : <NAME>, <NAME>
 */

package org.opendaylight.ovsdb.schema.openvswitch;

import static org.opendaylight.ovsdb.lib.operations.Operations.op;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;
import org.opendaylight.ovsdb.lib.message.UpdateNotification;
import org.opendaylight.ovsdb.lib.notation.Mutator;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.OperationResult;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
;

public class BridgeTestCases extends OpenVswitchSchemaTestBase {
    Logger logger = LoggerFactory.getLogger(BridgeTestCases.class);

    @Override
    @Before
    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
        super.setUp();
     }

    @Test
    public void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        Bridge bridge = this.ovs.createTypedRowWrapper(Bridge.class);
        Assert.assertNotNull(bridge);
        bridge.setName(TEST_BRIDGE_NAME);
        bridge.setStatus(ImmutableMap.of("key", "value"));<commit_msg>Adding JavaDoc to one of the IT cases to demonstrate the Sonar IT Documentation<commit_after>/*
 * Copyright (C) 2014 Red Hat, Inc.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 *
 *  Authors : <NAME>, <NAME>
 */

package org.opendaylight.ovsdb.schema.openvswitch;

import static org.opendaylight.ovsdb.lib.operations.Operations.op;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;
import org.opendaylight.ovsdb.lib.message.UpdateNotification;
import org.opendaylight.ovsdb.lib.notation.Mutator;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
import org.opendaylight.ovsdb.lib.operations.OperationResult;
import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ListenableFuture;
;
/**
 * BridgeTestCases covers all the Integration Test Cases required for OVS Bridge.
 *
 * Since OVSDB library is schema independent, these Open_vSwitch schema specific
 * test cases covers the testing needs for both the Schema wrapper layer : schema.openvswitch
 * and the underlying library which performs the schema independent way to access the network
 * entity that talks OVSDB protocol.
 *
 */
public class BridgeTestCases extends OpenVswitchSchemaTestBase {
    Logger logger = LoggerFactory.getLogger(BridgeTestCases.class);

    @Override
    @Before
    public void setUp() throws ExecutionException, InterruptedException, TimeoutException, IOException {
        super.setUp();
     }

    /**
     * Creates a Open_vSwitch Bridge using the schema.openvswitch wrapper Bridge class.
     * This test case performs the following tests and asserts on failures :
     * 1. Creates and asserts on a wrapper software-only Bridge object using the Schema-independent library.
     * 2. Populates Bridge Columns such as Name, Status, Vlans using the wrapper layer.
     * 3. Tests OVSDB libraries transact functionality by inserting the bridge, Mutating the parent Open_vSwitch
     *    table and Updating the bridge all in a single Transaction.
     * 4. Validates the Transaction success condition by
     *    1. Comparing the number of requests with the number or response objects,
     *    2. Checking for any error in any of the response objects.
     * 5. Confirm the Creation of the Bridge by validating against the Table cache that gets populated by the
     *    Monitor operation.
     */
    @Test
    public void createTypedBridge() throws IOException, InterruptedException, ExecutionException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        Bridge bridge = this.ovs.createTypedRowWrapper(Bridge.class);
        Assert.assertNotNull(bridge);
        bridge.setName(TEST_BRIDGE_NAME);
        bridge.setStatus(ImmutableMap.of("key", "value"));
{'fraction_non_alphanumeric': 0.08127340823970038, 'fraction_numerical': 0.0050561797752808986, 'mean_word_length': 4.592670157068063, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '381821', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1471, 'n_words': 423}