/**
 * Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved.
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.kaazing.gateway.management.impl;

import java.net.URI;
import org.junit.Test;
import org.kaazing.gateway.server.test.Gateway;
import org.kaazing.gateway.server.test.config.GatewayConfiguration;
import org.kaazing.gateway.server.test.config.builder.GatewayConfigurationBuilder;

public class ServiceDefaultsConfigurationBeanImplTest {

    private final URI SNMP_SERVICE_ACCEPT_URL = URI.create("ws://localhost:8000/snmp");
    private final String SNMP_SERVICE_NAME = "SNMP Management Service";
    private final String SNMP_SERVICE_TYPE = "management.snmp";

    @Test
    public void testServiceDefaultsWithoutSslCiphers() throws Exception {
        /**
         * Point of test is create a service with service defaults that do not contain any specification
         * of sslCiphers and see what we get from the service defaults management bean. It should correctly
         * give us a JSON string without any mention of "ssl.ciphers".
         */
        GatewayConfigurationBuilder configBuilder = new GatewayConfigurationBuilder();

        GatewayConfiguration gatewayConfiguration =
                configBuilder
                        .service()
                        .name(SNMP_SERVICE_NAME)
                        .accept(SNMP_SERVICE_ACCEPT_URL)
                        .type(SNMP_SERVICE_TYPE)
                        .done()
                        .serviceDefaults()
                        .acceptOption("ssl.encryption", "enabled")
                        .acceptOption("ssl.verify.client", "none")
                        .done()
                        .done();

        Gateway gateway = new Gateway();

        try {
            gateway.start(gatewayConfiguration);

            // If we hit the bug (KG-10371) this is for, we'd get an NPE because of missing ssl.ciphers
        } finally {
            gateway.stop();
        }
    }

    @Test
    public void testServiceDefaultsWithSslCiphers() throws Exception {
        /**
         * Point of test is create a service with service defaults that do not contain any specification
         * of sslCiphers and see what we get from the service defaults management bean. It should correctly
         * give us a JSON string without any mention of "ssl.ciphers".
         */
        GatewayConfigurationBuilder configBuilder = new GatewayConfigurationBuilder();

        GatewayConfiguration gatewayConfiguration =
                configBuilder
                        .service()
                        .name(SNMP_SERVICE_NAME)
                        .accept(SNMP_SERVICE_ACCEPT_URL)
                        .type(SNMP_SERVICE_TYPE)
                        .done()
                        .serviceDefaults()
                        .acceptOption("ssl.encryption", "enabled")
                        .acceptOption("ssl.ciphers", "HIGH")
                        .done()
                        .done();

        Gateway gateway = new Gateway();

        try {
            gateway.start(gatewayConfiguration);

            // How do we check the management stuff here?
        } finally {
            gateway.stop();
        }
    }

}

@@ -932,43 +932,214 @@
 ort 
-java.net.URI;%0Aimport org.junit.Test
+static java.util.concurrent.TimeUnit.SECONDS;%0Aimport static org.kaazing.test.util.ITUtil.createRuleChain;%0A%0Aimport java.net.URI;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TestRule
 ;%0Aim
@@ -1618,16 +1618,85 @@
 snmp%22;%0A%0A
+    @Rule%0A    public TestRule chain = createRuleChain(20, SECONDS);%0A%0A
     @Tes

Add timeout and method trace rule to ServiceDefaultsConfigurationBeanImplTest.