<relativePath>..</relativePath>
</parent>
<artifactId>sonar-server</artifactId>
- <packaging>jar</packaging>
<name>SonarQube :: Server</name>
<properties>
- <argLine>-Xmx1G -Djava.awt.headless=true -XX:MaxPermSize=128m</argLine>
+ <argLine>-Xmx512m -Djava.awt.headless=true -XX:MaxPermSize=128m</argLine>
</properties>
<dependencies>
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
import org.elasticsearch.client.Client;
+import org.elasticsearch.common.Priority;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.metrics.max.Max;
return health;
}
-
public RefreshRequestBuilder prepareRefresh(String... indices) {
return new ProxyRefreshRequestBuilder(client, profiling).setIndices(indices);
}
return new ProxyClusterHealthRequestBuilder(client, profiling).setIndices(indices);
}
+ public void waitForStatus(ClusterHealthStatus status) {
+ prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForStatus(status).get();
+ }
+
public IndicesExistsRequestBuilder prepareExists(String... indices) {
return new ProxyIndicesExistsRequestBuilder(client, profiling, indices);
}
@Override
public void stop() {
// TODO re-enable when SearchClient is dropped
- //client.close();
+ // client.close();
}
protected Client nativeClient() {
package org.sonar.server.es;
import org.apache.commons.lang.StringUtils;
+import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
-import org.elasticsearch.common.Priority;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.picocontainer.Startable;
import org.slf4j.Logger;
if (!indexResponse.isAcknowledged()) {
throw new IllegalStateException("Failed to create index " + index.getName());
}
- client.prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().get();
+ client.waitForStatus(ClusterHealthStatus.YELLOW);
// create types
for (Map.Entry<String, IndexRegistry.IndexType> entry : index.getTypes().entrySet()) {
throw new IllegalStateException("Failed to create type " + entry.getKey());
}
}
+ client.waitForStatus(ClusterHealthStatus.YELLOW);
}
private void deleteIndex(String indexName) {
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class BulkIndexerTest {
@Rule
*/
package org.sonar.server.es;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.server.search.request.ProxyBulkRequestBuilder;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class EsClientTest {
@Rule
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import org.elasticsearch.search.SearchHit;
-import org.junit.Ignore;
import org.junit.rules.ExternalResource;
import org.sonar.api.config.Settings;
import org.sonar.api.platform.ComponentContainer;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class EsTester extends ExternalResource {
private static final int INSTANCE_ID = RandomUtils.nextInt();
}
protected void before() throws Throwable {
- String nodeName = "es-ram-" + INSTANCE_ID;
+ String nodeName = "tmp-es-" + INSTANCE_ID;
node = NodeBuilder.nodeBuilder().local(true).data(true).settings(ImmutableSettings.builder()
.put("cluster.name", nodeName)
.put("node.name", nodeName)
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.collect.ImmutableOpenMap;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class IndexCreatorTest {
@Rule
package org.sonar.server.issue.index;
import org.elasticsearch.search.SearchHit;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.config.Settings;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class IssueAuthorizationIndexerTest {
@Rule
package org.sonar.server.issue.index;
import com.google.common.collect.Iterators;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.config.Settings;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class IssueIndexerTest {
@Rule
package org.sonar.server.source.index;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.config.Settings;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class SourceLineIndexTest {
@Rule
import org.elasticsearch.index.query.QueryBuilders;
import org.fest.assertions.MapAssert;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonar.api.config.Settings;
import static org.fest.assertions.Assertions.assertThat;
-@Ignore
public class SourceLineIndexerTest {
@Rule
platform.addComponents(components);
platform.doStart();
} catch (Exception e) {
- LOG.error("Fail to start ServerTester", e);
stop();
Throwables.propagate(e);
}