diff --git a/README.md b/README.md index a987358..04bfab3 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,7 @@ Test your setup http://asquera.de/blog/2013-07-10/an-elasticsearch-workflow/ ## How to setup MYSQL locally `docker run -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_DATABASE=flowupdb -e MYSQL_USER=flowupUser -e MYSQL_PASSWORD=flowupPassword -p 127.0.0.1:3306:3306 -d mysql:5.6` + +## How to setup grafana locally + +`docker run -p 3000:3000 -d grafana/grafana` diff --git a/app/Module.java b/app/Module.java index 11c8296..58a8824 100644 --- a/app/Module.java +++ b/app/Module.java @@ -1,6 +1,6 @@ import com.google.inject.AbstractModule; import com.google.inject.name.Names; -import datasources.ElasticSearchDatasource; +import datasources.elasticsearch.ElasticSearchDatasource; import play.Configuration; import play.Environment; import usecases.MetricsDatasource; @@ -27,5 +27,10 @@ protected void configure() { bind(MetricsDatasource.class) .to(ElasticSearchDatasource.class) .asEagerSingleton(); + + Configuration grafanaConf = configuration.getConfig("grafana"); + bind(Configuration.class) + .annotatedWith(Names.named("grafana")) + .toInstance(grafanaConf); } } diff --git a/app/controllers/admin/UserController.java b/app/controllers/admin/UserController.java index a8acab4..2b130b1 100644 --- a/app/controllers/admin/UserController.java +++ b/app/controllers/admin/UserController.java @@ -85,13 +85,13 @@ public Result update(String id) throws PersistenceException { User savedUser = User.find.byId(uuid); if (savedUser != null) { User newUserData = userForm.get(); - savedUser.email = newUserData.email; - savedUser.name = newUserData.name; - savedUser.active = newUserData.active; - savedUser.emailValidated = newUserData.emailValidated; + savedUser.setEmail(newUserData.getEmail()); + savedUser.setName(newUserData.getName()); + savedUser.setActive(newUserData.isActive()); + savedUser.setEmailValidated(newUserData.isEmailValidated()); savedUser.update(); - flash("success", "Computer " + userForm.get().name + " has been updated"); + flash("success", "Computer " + userForm.get().getName() + " has been updated"); txn.commit(); } } finally { @@ -120,7 +120,7 @@ public Result save() { return badRequest(views.html.admin.user.createForm.render(userForm)); } userForm.get().save(); - flash("success", "User " + userForm.get().name + " has been created"); + flash("success", "User " + userForm.get().getName() + " has been created"); return GO_HOME; } diff --git a/app/datasources/ActionWriteResponse.java b/app/datasources/elasticsearch/ActionWriteResponse.java similarity index 90% rename from app/datasources/ActionWriteResponse.java rename to app/datasources/elasticsearch/ActionWriteResponse.java index 636b15a..4dcb410 100644 --- a/app/datasources/ActionWriteResponse.java +++ b/app/datasources/elasticsearch/ActionWriteResponse.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import lombok.Data; import org.jetbrains.annotations.Nullable; diff --git a/app/datasources/BulkError.java b/app/datasources/elasticsearch/BulkError.java similarity index 92% rename from app/datasources/BulkError.java rename to app/datasources/elasticsearch/BulkError.java index 8c46325..18b129e 100644 --- a/app/datasources/BulkError.java +++ b/app/datasources/elasticsearch/BulkError.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/app/datasources/BulkItemResponse.java b/app/datasources/elasticsearch/BulkItemResponse.java similarity index 95% rename from app/datasources/BulkItemResponse.java rename to app/datasources/elasticsearch/BulkItemResponse.java index 009d576..7d0a27c 100644 --- a/app/datasources/BulkItemResponse.java +++ b/app/datasources/elasticsearch/BulkItemResponse.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/app/datasources/BulkResponse.java b/app/datasources/elasticsearch/BulkResponse.java similarity index 94% rename from app/datasources/BulkResponse.java rename to app/datasources/elasticsearch/BulkResponse.java index c008e40..c96cfbc 100644 --- a/app/datasources/BulkResponse.java +++ b/app/datasources/elasticsearch/BulkResponse.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import lombok.Data; diff --git a/app/datasources/ElasticSearchDatasource.java b/app/datasources/elasticsearch/ElasticSearchDatasource.java similarity index 99% rename from app/datasources/ElasticSearchDatasource.java rename to app/datasources/elasticsearch/ElasticSearchDatasource.java index 004d99b..1d8df54 100644 --- a/app/datasources/ElasticSearchDatasource.java +++ b/app/datasources/elasticsearch/ElasticSearchDatasource.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.databind.node.ObjectNode; import play.libs.F; diff --git a/app/datasources/ElasticsearchClient.java b/app/datasources/elasticsearch/ElasticsearchClient.java similarity index 98% rename from app/datasources/ElasticsearchClient.java rename to app/datasources/elasticsearch/ElasticsearchClient.java index 633e6b5..ee6698c 100644 --- a/app/datasources/ElasticsearchClient.java +++ b/app/datasources/elasticsearch/ElasticsearchClient.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.databind.JsonNode; import org.apache.commons.lang3.StringUtils; diff --git a/app/datasources/IndexAction.java b/app/datasources/elasticsearch/IndexAction.java similarity index 92% rename from app/datasources/IndexAction.java rename to app/datasources/elasticsearch/IndexAction.java index 3e00184..fc9c89d 100644 --- a/app/datasources/IndexAction.java +++ b/app/datasources/elasticsearch/IndexAction.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; diff --git a/app/datasources/IndexRequest.java b/app/datasources/elasticsearch/IndexRequest.java similarity index 89% rename from app/datasources/IndexRequest.java rename to app/datasources/elasticsearch/IndexRequest.java index f3df078..120eeaa 100644 --- a/app/datasources/IndexRequest.java +++ b/app/datasources/elasticsearch/IndexRequest.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.databind.JsonNode; import lombok.Data; diff --git a/app/datasources/IndexResponse.java b/app/datasources/elasticsearch/IndexResponse.java similarity index 97% rename from app/datasources/IndexResponse.java rename to app/datasources/elasticsearch/IndexResponse.java index 342a299..b905282 100644 --- a/app/datasources/IndexResponse.java +++ b/app/datasources/elasticsearch/IndexResponse.java @@ -1,4 +1,4 @@ -package datasources; +package datasources.elasticsearch; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/app/datasources/grafana/GrafanaClient.java b/app/datasources/grafana/GrafanaClient.java new file mode 100644 index 0000000..b45a7d7 --- /dev/null +++ b/app/datasources/grafana/GrafanaClient.java @@ -0,0 +1,123 @@ +package datasources.grafana; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import models.Organization; +import models.User; +import org.apache.commons.lang3.RandomStringUtils; +import org.jetbrains.annotations.NotNull; +import play.Configuration; +import play.Logger; +import play.libs.Json; +import play.libs.ws.WSClient; +import play.libs.ws.WSRequest; +import play.libs.ws.WSResponse; +import play.mvc.Http; + +import javax.inject.Inject; +import javax.inject.Named; +import java.security.SecureRandom; +import java.util.UUID; +import java.util.concurrent.CompletionStage; + +public class GrafanaClient { + + private static final String API_ORGS_ORG_ID_USERS = "/api/orgs/:orgId/users"; + private static final String API_ORGS_ORG_ID_USERS_USER_ID = "/api/orgs/:orgId/users/:userId"; + private final WSClient ws; + private final String baseUrl; + private final String apiKey; + private final String adminUser; + private final String adminPassword; + + @Inject + public GrafanaClient(WSClient ws, @Named("grafana") Configuration grafanaConf) { + this.ws = ws; + + this.apiKey = grafanaConf.getString("api_key"); + this.adminUser = grafanaConf.getString("admin_user"); + this.adminPassword = grafanaConf.getString("admin_password"); + + String scheme = grafanaConf.getString("scheme"); + String host = grafanaConf.getString("host"); + String port = grafanaConf.getString("port"); + this.baseUrl = scheme + "://" + host + ":" + port; + } + + public CompletionStage createUser(final User user) { + String adminUserEndpoint = "/api/admin/users"; + + String grafanaPassword = PasswordGenerator.generatePassword(); + ObjectNode userRequest = Json.newObject() + .put("name", user.getName()) + .put("email", user.getEmail()) + .put("password", grafanaPassword); + + UUID userId = user.getId(); + + Logger.debug(userRequest.toString()); + + return getWsRequestForAdminUser(adminUserEndpoint).post(userRequest).thenApply(response -> { + Logger.debug(response.getBody()); + if (response.getStatus() == Http.Status.OK) { + updateUserWithGrafanaInfo(grafanaPassword, userId, response); + } + return Json.fromJson(response.asJson(), GrafanaResponse.class); + }); + } + + private void updateUserWithGrafanaInfo(String grafanaPassword, UUID userId, WSResponse response) { + String id = response.asJson().get("id").toString(); + User createdUser = User.find.byId(userId); + createdUser.setGrafanaUserId(id); + createdUser.setGrafanaPassword(grafanaPassword); + createdUser.save(); + } + + public CompletionStage addUserToOrganisation(User user, Organization organization) { + String adminUserEndpoint = API_ORGS_ORG_ID_USERS.replaceFirst(":orgId", organization.grafanaId); + + ObjectNode userRequest = Json.newObject() + .put("loginOrEmail", user.getEmail()) + .put("role", "Viewer"); + + UUID userId = user.getId(); + + Logger.debug(userRequest.toString()); + + return getWsRequestForAdminUser(adminUserEndpoint).post(userRequest).thenApply(response -> { + Logger.debug(response.getBody()); + return Json.fromJson(response.asJson(), GrafanaResponse.class); + }); + } + + public CompletionStage deleteUserInDefaultOrganisation(User user) { + String adminUserEndpoint = API_ORGS_ORG_ID_USERS_USER_ID.replaceFirst(":orgId", "1").replaceFirst(":userId", user.getGrafanaUserId()); + + return getWsRequestForAdminUser(adminUserEndpoint).delete().thenApply(response -> { + Logger.debug(response.getBody()); + return Json.fromJson(response.asJson(), GrafanaResponse.class); + }); + } + + private WSRequest getWsRequestForAdminUser(String adminUserEndpoint) { + WSRequest wsRequest = ws.url(baseUrl + adminUserEndpoint).setHeader("Accept", "application/json").setContentType("application/json") + .setAuth(this.adminUser, this.adminPassword); + Logger.debug(wsRequest.getHeaders().toString()); + return wsRequest; + } + + private WSRequest getWsRequest(String adminUserEndpoint) { + WSRequest wsRequest = ws.url(baseUrl + adminUserEndpoint).setHeader("Accept", "application/json").setContentType("application/json") + .setHeader("Authorization", "Bearer " + this.apiKey); + Logger.debug(wsRequest.getHeaders().toString()); + return wsRequest; + } +} + +class PasswordGenerator { + @NotNull + static String generatePassword() { + String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~`!@#$%^&*()-_=+[{]}\\|;:\'\",<.>/?"; + return RandomStringUtils.random(255, 0, 0, false, false, characters.toCharArray(), new SecureRandom()); + } +} \ No newline at end of file diff --git a/app/datasources/grafana/GrafanaResponse.java b/app/datasources/grafana/GrafanaResponse.java new file mode 100644 index 0000000..349abbd --- /dev/null +++ b/app/datasources/grafana/GrafanaResponse.java @@ -0,0 +1,9 @@ +package datasources.grafana; + + +import lombok.Data; + +@Data +public class GrafanaResponse { + private String message; +} diff --git a/app/models/Organization.java b/app/models/Organization.java index 7a45d0f..7bfc0fe 100644 --- a/app/models/Organization.java +++ b/app/models/Organization.java @@ -1,5 +1,6 @@ package models; +import com.avaje.ebean.ExpressionList; import com.avaje.ebean.Model; import javax.persistence.Entity; @@ -22,5 +23,16 @@ public class Organization { @ManyToMany public List members; + public String grafanaId; + public static Model.Finder find = new Model.Finder<>(Organization.class); + + public static Organization findByGoogleAccount(String googleAccount) { + return getGoogleAccountUserFind(googleAccount).findUnique(); + } + + private static ExpressionList getGoogleAccountUserFind(String googleAccount) { + return find.where().eq("google_account", googleAccount); + } + } diff --git a/app/models/User.java b/app/models/User.java index c750cd4..ea5b0c9 100644 --- a/app/models/User.java +++ b/app/models/User.java @@ -14,28 +14,31 @@ import javax.persistence.*; import java.util.*; -@Data @Entity public class User extends Model { @Id - public UUID id; + private UUID id; @Constraints.Email @Column(unique = true) - public String email; + private String email; @Constraints.Required - public String name; + private String name; - public boolean active; + private boolean active; - public boolean emailValidated; + private boolean emailValidated; + + private String grafanaUserId; + + private String grafanaPassword; @OneToMany(cascade = CascadeType.ALL) - public List linkedAccounts; + private List linkedAccounts; @ManyToMany(mappedBy = "members") - public List organizations; + private List organizations; public static final Finder find = new Finder<>(User.class); @@ -137,4 +140,76 @@ private static ExpressionList getEmailUserFind(final String email) { public LinkedAccount getAccountByProvider(final String providerKey) { return LinkedAccount.findByProviderKey(this, providerKey); } + + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public boolean isEmailValidated() { + return emailValidated; + } + + public void setEmailValidated(boolean emailValidated) { + this.emailValidated = emailValidated; + } + + public String getGrafanaUserId() { + return grafanaUserId; + } + + public void setGrafanaUserId(String grafanaUserId) { + this.grafanaUserId = grafanaUserId; + } + + public String getGrafanaPassword() { + return grafanaPassword; + } + + public void setGrafanaPassword(String grafanaPassword) { + this.grafanaPassword = grafanaPassword; + } + + public List getLinkedAccounts() { + return linkedAccounts; + } + + public void setLinkedAccounts(List linkedAccounts) { + this.linkedAccounts = linkedAccounts; + } + + public List getOrganizations() { + return organizations; + } + + public void setOrganizations(List organizations) { + this.organizations = organizations; + } } diff --git a/app/module/AuthenticationModule.java b/app/module/AuthenticationModule.java index 560fee7..4f5e129 100644 --- a/app/module/AuthenticationModule.java +++ b/app/module/AuthenticationModule.java @@ -1,7 +1,6 @@ package module; import com.feth.play.module.pa.Resolver; -import com.feth.play.module.pa.providers.oauth2.github.GithubAuthProvider; import com.feth.play.module.pa.providers.oauth2.google.GoogleAuthProvider; import com.google.inject.AbstractModule; import service.AuthenticationResolver; @@ -13,7 +12,6 @@ protected void configure() { // play-authenticate dependencies bind(Resolver.class).to(AuthenticationResolver.class); // Following class depend on PlayAuthenticate auth, and they self register to it. - bind(GithubAuthProvider.class).asEagerSingleton(); bind(GoogleAuthProvider.class).asEagerSingleton(); bind(FlowUpUserService.class).asEagerSingleton(); } diff --git a/app/service/FlowUpUserService.java b/app/service/FlowUpUserService.java index 5a6062c..f74410d 100644 --- a/app/service/FlowUpUserService.java +++ b/app/service/FlowUpUserService.java @@ -4,37 +4,76 @@ import com.feth.play.module.pa.service.AbstractUserService; import com.feth.play.module.pa.user.AuthUser; import com.feth.play.module.pa.user.AuthUserIdentity; +import datasources.grafana.GrafanaClient; +import models.Organization; import models.User; +import play.Logger; import javax.inject.Inject; import javax.inject.Singleton; +import java.util.concurrent.ExecutionException; @Singleton public class FlowUpUserService extends AbstractUserService { + private final GrafanaClient grafanaClient; + @Inject - public FlowUpUserService(final PlayAuthenticate auth) { + public FlowUpUserService(PlayAuthenticate auth, GrafanaClient grafanaClient) { super(auth); + this.grafanaClient = grafanaClient; } @Override - public Object save(final AuthUser authUser) { + public Object save(AuthUser authUser) { final boolean isLinked = User.existsByAuthUserIdentity(authUser); if (!isLinked) { - return User.create(authUser).id; + User user = User.create(authUser); + createGrafanaUser(user); + addUserToGrafanaOrg(user); + return user.getId(); } else { + User user = User.findByAuthUserIdentity(authUser); + createGrafanaUser(user); + addUserToGrafanaOrg(user); // we have this user already, so return null return null; } } + private void createGrafanaUser(User user) { + try { + grafanaClient.createUser(user).toCompletableFuture().get(); + } catch (InterruptedException e) { + Logger.debug(e.getMessage()); + } catch (ExecutionException e) { + Logger.debug(e.getMessage()); + } + } + + private void addUserToGrafanaOrg(User user) { + String[] split = user.getEmail().split("@"); + if (split.length == 2) { + Organization organization = Organization.findByGoogleAccount("@" + split[1]); + try { + grafanaClient.addUserToOrganisation(user, organization).toCompletableFuture().get(); + user.refresh(); + grafanaClient.deleteUserInDefaultOrganisation(user).toCompletableFuture().get(); + } catch (InterruptedException e) { + Logger.debug(e.getMessage()); + } catch (ExecutionException e) { + Logger.debug(e.getMessage()); + } + } + } + @Override public Object getLocalIdentity(final AuthUserIdentity identity) { // For production: Caching might be a good idea here... // ...and dont forget to sync the cache when users get deactivated/deleted final User u = User.findByAuthUserIdentity(identity); if(u != null) { - return u.id; + return u.getId(); } else { return null; } diff --git a/app/views/admin/user/list.scala.html b/app/views/admin/user/list.scala.html index 6cd2003..78b94e6 100644 --- a/app/views/admin/user/list.scala.html +++ b/app/views/admin/user/list.scala.html @@ -78,27 +78,19 @@

@Messages("users.list.title", currentPage.getTotalRowCount) - @user.name + @user.getName - @if(user.email == null) { + @if(user.getEmail == null) { - } else { - @user.email + @user.getEmail } - @if(user.active == null) { - - - } else { - @user.active - } + @user.isActive - @if(user.emailValidated == null) { - - - } else { - @user.emailValidated - } + @user.isEmailValidated } diff --git a/app/views/commandcenter.scala.html b/app/views/commandcenter.scala.html index 3c959b8..9a0a0d6 100644 --- a/app/views/commandcenter.scala.html +++ b/app/views/commandcenter.scala.html @@ -5,9 +5,9 @@ @main("Command Center") {

- Your name is @localUser and your email address is @localUser.email + Your name is @localUser and your email address is @localUser.getEmail - @if(!localUser.emailValidated) { + @if(!localUser.isEmailValidated) { (unverified) } else { (verified) diff --git a/conf/application.conf b/conf/application.conf index 9e92c45..2bf8200 100644 --- a/conf/application.conf +++ b/conf/application.conf @@ -368,3 +368,24 @@ elasticsearch { } include "play-authenticate/mine.conf" + +grafana { + admin_user = "admin" + admin_user = ${?GF_ADMIN_USER} + + admin_password = "admin" + admin_password = ${?GF_ADMIN_PASSWORD} + + api_key = "eyJrIjoib2U5eXdXM1NGR1cxRFBsM29MOFZXdllZWmI1QVUzSHQiLCJuIjoiYWRtaW4ta2V5IiwiaWQiOjF9" + api_key = ${?GF_API_KEY} + + scheme = "http" + scheme = ${?GF_SCHEME} + + host = "localhost" + host = ${?GF_HOST} + + port = "3000" + port = ${?GF_PORT} + +} \ No newline at end of file diff --git a/conf/evolutions/default/4.sql b/conf/evolutions/default/4.sql new file mode 100644 index 0000000..3906ad3 --- /dev/null +++ b/conf/evolutions/default/4.sql @@ -0,0 +1,7 @@ +# --- !Ups + +ALTER TABLE user ADD grafana_password varchar(255); + +# --- !Downs + +ALTER TABLE user DROP COLUMN grafana_password; diff --git a/conf/evolutions/default/5.sql b/conf/evolutions/default/5.sql new file mode 100644 index 0000000..6eaa5e5 --- /dev/null +++ b/conf/evolutions/default/5.sql @@ -0,0 +1,8 @@ +# --- !Ups + +ALTER TABLE organization ADD grafana_id varchar(255); +ALTER TABLE organization ADD google_account varchar(255); + +# --- !Downs + +ALTER TABLE organization DROP COLUMN grafana_id, DROP COLUMN google_account; diff --git a/conf/evolutions/default/6.sql b/conf/evolutions/default/6.sql new file mode 100644 index 0000000..0c6f16b --- /dev/null +++ b/conf/evolutions/default/6.sql @@ -0,0 +1,7 @@ +# --- !Ups + +ALTER TABLE user ADD grafana_user_id varchar(20); + +# --- !Downs + +ALTER TABLE user DROP COLUMN grafana_user_id; diff --git a/conf/play-authenticate/mine.conf b/conf/play-authenticate/mine.conf index 6b6f82c..9e2d67d 100644 --- a/conf/play-authenticate/mine.conf +++ b/conf/play-authenticate/mine.conf @@ -42,27 +42,4 @@ play-authenticate { clientSecret=DjoMu1LxjD1jv-fc-_CptWcU clientId=${?GOOGLE_CLIENT_SECRET} } - - # The Github settings - github { - redirectUri { - # Whether the redirect URI scheme should be HTTP or HTTPS (HTTP by default) - secure=false - - # You can use this setting to override the automatic detection - # of the host used for the redirect URI (helpful if your service is running behind a CDN for example) - # host=yourdomain.com - } - - # Read about available scopes here: http://developer.github.com/v3/oauth/#scopes - scope="user" - - # Github credentials - # Get them here: https://github.com/settings/applications/new - # Remove leading '#' after entering: - clientId="586c02f8df9349e3e1b9" - clientId=${?GITHUB_CLIENT_ID} - clientSecret="0f99cce6ffaaafdabaa6c7d9f9289d0f8e04714e" - clientSecret=${?GITHUB_CLIENT_SECRET} - } } diff --git a/test/IntegrationTest.java b/test/IntegrationTest.java index 2a452c0..c074071 100644 --- a/test/IntegrationTest.java +++ b/test/IntegrationTest.java @@ -36,7 +36,6 @@ public void testLogin() { browser.goTo("/login"); assertNotNull(browser.$("div#logins a")); List logins = new ArrayList<>(); - logins.add("github"); logins.add("google"); assertEquals(logins, (browser.$("div#logins a").getTexts())); } diff --git a/test/ServerFunctionalTest.java b/test/ServerFunctionalTest.java index e248b91..3d25c06 100644 --- a/test/ServerFunctionalTest.java +++ b/test/ServerFunctionalTest.java @@ -1,8 +1,8 @@ import com.google.common.collect.ImmutableMap; -import datasources.BulkItemResponse; -import datasources.BulkResponse; -import datasources.ElasticsearchClient; -import datasources.IndexRequest; +import datasources.elasticsearch.BulkItemResponse; +import datasources.elasticsearch.BulkResponse; +import datasources.elasticsearch.ElasticsearchClient; +import datasources.elasticsearch.IndexRequest; import models.ApiKey; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/test/controllers/ReportControllerTest.java b/test/controllers/ReportControllerTest.java index 356b491..508e074 100644 --- a/test/controllers/ReportControllerTest.java +++ b/test/controllers/ReportControllerTest.java @@ -2,7 +2,7 @@ import com.google.common.collect.ImmutableMap; -import datasources.*; +import datasources.elasticsearch.*; import models.ApiKey; import org.junit.Ignore; import org.junit.Test; diff --git a/test/datasources/ElasticSearchDatasourceTest.java b/test/datasources/ElasticSearchDatasourceTest.java index b522b26..fefab40 100644 --- a/test/datasources/ElasticSearchDatasourceTest.java +++ b/test/datasources/ElasticSearchDatasourceTest.java @@ -1,6 +1,7 @@ package datasources; import com.fasterxml.jackson.databind.JsonNode; +import datasources.elasticsearch.*; import org.jetbrains.annotations.NotNull; import org.junit.Test; import org.junit.runner.RunWith;