Skip to content

Commit

Permalink
♻️ : moves stack feature to its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Aug 12, 2019
1 parent 090ab53 commit 3705dee
Show file tree
Hide file tree
Showing 35 changed files with 90 additions and 78 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/codeka/gaia/controller/IndexController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.controller;

import io.codeka.gaia.bo.StackState;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.bo.StackState;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.teams.bo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.codeka.gaia.modules.repository;

import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.strategy.GitHubStrategy;
import io.codeka.gaia.repository.strategy.GitLabStrategy;
import io.codeka.gaia.repository.strategy.GitPlatformStrategy;
import io.codeka.gaia.modules.repository.strategy.GitHubStrategy;
import io.codeka.gaia.modules.repository.strategy.GitLabStrategy;
import io.codeka.gaia.modules.repository.strategy.GitPlatformStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.repository.strategy;
package io.codeka.gaia.modules.repository.strategy;

import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.repository.strategy;
package io.codeka.gaia.modules.repository.strategy;

import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.repository.strategy;
package io.codeka.gaia.modules.repository.strategy;

import org.apache.commons.lang.StringUtils;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/codeka/gaia/runner/StackCommandBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import com.github.mustachejava.Mustache;
import io.codeka.gaia.bo.Settings;
import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.bo.mustache.TerraformScript;
import io.codeka.gaia.stacks.bo.mustache.TerraformScript;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/io/codeka/gaia/runner/StackRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
import com.spotify.docker.client.messages.ContainerConfig;
import io.codeka.gaia.bo.*;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.bo.JobType;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.bo.StackState;
import org.apache.commons.io.output.WriterOutputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.codeka.gaia.teams.bo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

public enum JobStatus {
RUNNING, FINISHED, FAILED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

public enum JobType {
PREVIEW, RUN, STOP
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.teams.bo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

/**
* Represents the state of a Stack.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.bo.mustache;
package io.codeka.gaia.stacks.bo.mustache;

/**
* Object matching the terraform mustache template
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.repository.JobRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import io.codeka.gaia.runner.StackRunner;
import io.codeka.gaia.teams.bo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.service.StackCostCalculator;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.stacks.service.StackCostCalculator;
import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.teams.bo.User;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.TerraformState;
import io.codeka.gaia.repository.TerraformStateRepository;
import io.codeka.gaia.stacks.bo.TerraformState;
import io.codeka.gaia.stacks.repository.TerraformStateRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.codeka.gaia.repository;
package io.codeka.gaia.stacks.repository;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.stacks.bo.Job;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.repository;
package io.codeka.gaia.stacks.repository;

import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.bo.StackState;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.bo.StackState;
import io.codeka.gaia.teams.bo.Team;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.codeka.gaia.repository;
package io.codeka.gaia.stacks.repository;

import io.codeka.gaia.bo.TerraformState;
import io.codeka.gaia.stacks.bo.TerraformState;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package io.codeka.gaia.service;
package io.codeka.gaia.stacks.service;

import io.codeka.gaia.bo.JobStatus;
import io.codeka.gaia.bo.JobType;
import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.stacks.bo.JobStatus;
import io.codeka.gaia.stacks.bo.JobType;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.controller;

import io.codeka.gaia.bo.StackState;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.bo.StackState;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.teams.bo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.codeka.gaia.modules.repository;

import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.strategy.GitPlatformStrategy;
import io.codeka.gaia.modules.repository.strategy.GitPlatformStrategy;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.repository.strategy;
package io.codeka.gaia.modules.repository.strategy;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.codeka.gaia.repository.strategy;
package io.codeka.gaia.modules.repository.strategy;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import io.codeka.gaia.bo.Settings;
import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.modules.bo.TerraformVariable;
import org.jetbrains.annotations.NotNull;
Expand Down
5 changes: 3 additions & 2 deletions src/test/java/io/codeka/gaia/runner/StackRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import com.spotify.docker.client.messages.ContainerExit;
import io.codeka.gaia.bo.*;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.stacks.bo.*;
import io.codeka.gaia.teams.bo.User;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package io.codeka.gaia.bo;
package io.codeka.gaia.stacks.bo;

import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.bo.JobStatus;
import io.codeka.gaia.stacks.bo.JobType;
import io.codeka.gaia.teams.bo.User;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.stacks.controller.JobNotFoundException;
import io.codeka.gaia.stacks.controller.JobRestController;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import io.codeka.gaia.runner.StackRunner;
import io.codeka.gaia.stacks.controller.StackController;
import io.codeka.gaia.teams.bo.User;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.codeka.gaia.controller;
package io.codeka.gaia.stacks.controller;

import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.repository.StackRepository;
import io.codeka.gaia.service.StackCostCalculator;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.stacks.service.StackCostCalculator;
import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.teams.bo.User;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -19,7 +19,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.codeka.gaia.repository;
package io.codeka.gaia.stacks.repository;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.bo.JobStatus;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.bo.JobStatus;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.teams.bo.User;
import io.codeka.gaia.teams.repository.UserRepository;
import io.codeka.gaia.test.MongoContainer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.codeka.gaia.repository;
package io.codeka.gaia.stacks.repository;

import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.bo.StackState;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.stacks.bo.StackState;
import io.codeka.gaia.stacks.repository.StackRepository;
import io.codeka.gaia.teams.bo.Team;
import io.codeka.gaia.test.MongoContainer;
import org.junit.jupiter.api.BeforeEach;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.codeka.gaia.service;
package io.codeka.gaia.stacks.service;

import io.codeka.gaia.bo.Job;
import io.codeka.gaia.bo.JobType;
import io.codeka.gaia.bo.Stack;
import io.codeka.gaia.stacks.bo.Job;
import io.codeka.gaia.stacks.bo.JobType;
import io.codeka.gaia.stacks.bo.Stack;
import io.codeka.gaia.modules.bo.TerraformModule;
import io.codeka.gaia.repository.JobRepository;
import io.codeka.gaia.stacks.repository.JobRepository;
import io.codeka.gaia.modules.repository.TerraformModuleRepository;
import io.codeka.gaia.teams.bo.User;
import org.junit.jupiter.api.Test;
Expand Down

0 comments on commit 3705dee

Please sign in to comment.