package org.elasticsearch.script;

import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
import org.junit.Test;

import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;

/**
 */
@ClusterScope(scope = Scope.SUITE, numDataNodes = 1)
public class NoShardsSettingTests extends ElasticsearchIntegrationTest {

    @Override
    public Settings nodeSettings(int nodeOrdinal) {
        return ImmutableSettings.settingsBuilder()
                .put("gateway.type", "none")
                .put("index.number_of_shards", 1)
                .put("index.number_of_replicas", 0)
                .put(super.nodeSettings(nodeOrdinal))
                .build();
    }

    @Test
    public void testNoOfShards() {
        assertAcked(prepareCreate("test").get());
        assertThat(client().admin().indices().prepareGetSettings("test").get().getSetting("test", "index.number_of_shards"), equalTo("1"));
    }

    @Override
    protected int numberOfShards() {
        return 1;
    }

    @Override
    public Settings indexSettings() {
        ImmutableSettings.Builder builder = ImmutableSettings.builder();

        builder.put(SETTING_NUMBER_OF_SHARDS, 1).build();

        builder.put(SETTING_NUMBER_OF_REPLICAS, 0).build();

        return builder.build();
    }

}

@@ -1,8 +1,798 @@
+/*%0A * Licensed to Elasticsearch under one or more contributor%0A * license agreements. See the NOTICE file distributed with%0A * this work for additional information regarding copyright%0A * ownership. Elasticsearch licenses this file to you under%0A * the Apache License, Version 2.0 (the %22License%22); you may%0A * not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0A%0A
 package 

Add missing license header