-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
389 additions
and
57 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
cascades-server/app/src/test/java/pl/gov/coi/cascades/server/AppMainStartTestIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package pl.gov.coi.cascades.server; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.Mock; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import static org.mockito.Matchers.any; | ||
import static org.mockito.Matchers.anyVararg; | ||
import static org.mockito.Mockito.when; | ||
|
||
/** | ||
* @author <a href="mailto:lukasz.malek@coi.gov.pl">Łukasz Małek</a> | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
@SpringBootTest(classes = AppMain.class) | ||
@ProductionHibernateTest | ||
public class AppMainStartTestIT { | ||
|
||
@Mock | ||
private SpringApplicationFactory applicationFactory; | ||
|
||
@Mock | ||
private SpringApplication application; | ||
|
||
@Mock | ||
private ConfigurableApplicationContext applicationContext; | ||
|
||
@Test | ||
public void shouldApplicationStartOnProductionProfile(){ | ||
//given | ||
AppMain.setAppMainSupplier(() -> new AppMain(applicationFactory)); | ||
|
||
when(applicationFactory.create(any())).thenReturn(application); | ||
when(application.run(anyVararg())).thenReturn(applicationContext); | ||
when(applicationContext.isActive()).thenReturn(true); | ||
|
||
// when | ||
try { | ||
AppMain.main(new String[0]); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
cascades-server/app/src/test/java/pl/gov/coi/cascades/server/ProdactionHibernateTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package pl.gov.coi.cascades.server; | ||
|
||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* @author <a href="mailto:lukasz.malek@coi.gov.pl">Łukasz Małek</a> | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@ActiveProfiles({Environment.PRODUCTION_NAME, ProfileType.HIBERNATE_NAME}) | ||
@interface ProductionHibernateTest { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...in/java/pl/gov/coi/cascades/server/persistance/hibernate/DatabaseInstanceGatewayImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package pl.gov.coi.cascades.server.persistance.hibernate; | ||
|
||
import pl.gov.coi.cascades.server.domain.DatabaseInstance; | ||
import pl.gov.coi.cascades.server.domain.DatabaseInstanceGateway; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
/** | ||
* @author <a href="mailto:lukasz.malek@coi.gov.pl">Łukasz Małek</a> | ||
*/ | ||
@Transactional | ||
public class DatabaseInstanceGatewayImpl implements DatabaseInstanceGateway { | ||
|
||
@Override | ||
@Deprecated | ||
public DatabaseInstance launchDatabase(DatabaseInstance databaseInstance) { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public void deleteDatabase(DatabaseInstance databaseInstance) { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public String getRemoteServerId() { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../main/java/pl/gov/coi/cascades/server/persistance/hibernate/DatabaseLimitGatewayImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package pl.gov.coi.cascades.server.persistance.hibernate; | ||
|
||
import pl.gov.coi.cascades.server.domain.DatabaseLimitGateway; | ||
import pl.gov.coi.cascades.server.domain.User; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
/** | ||
* @author <a href="mailto:lukasz.malek@coi.gov.pl">Łukasz Małek</a> | ||
*/ | ||
@Transactional | ||
public class DatabaseLimitGatewayImpl implements DatabaseLimitGateway { | ||
|
||
@Override | ||
@Deprecated | ||
public boolean isPersonalLimitExceeded(User user) { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public int getPersonalLimitPerUser(User user) { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public boolean isGlobalLimitExceeded() { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
|
||
@Override | ||
@Deprecated | ||
public int getGlobalLimit() { | ||
// TODO: write an implementation | ||
throw new UnsupportedOperationException("Not yet implemented!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.