Skip to content
Permalink
Browse files
Change package names from mifos to apache fineract.
  • Loading branch information
myrle-krantz committed Apr 13, 2018
1 parent f4619e3 commit 923455461140e818f81bbe6aea5357927dbe846a
Showing 86 changed files with 328 additions and 304 deletions.
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1;
package org.apache.fineract.cn.anubis.api.v1;

/**
* @author Myrle Krantz
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1;
package org.apache.fineract.cn.anubis.api.v1;

/**
* @author Myrle Krantz
@@ -16,12 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.client;
package org.apache.fineract.cn.anubis.api.v1.client;

import io.mifos.anubis.api.v1.domain.ApplicationSignatureSet;
import io.mifos.anubis.api.v1.domain.PermittableEndpoint;
import io.mifos.anubis.api.v1.domain.Signature;
import io.mifos.anubis.api.v1.validation.ValidKeyTimestamp;
import org.apache.fineract.cn.anubis.api.v1.domain.ApplicationSignatureSet;
import org.apache.fineract.cn.anubis.api.v1.domain.PermittableEndpoint;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.api.v1.validation.ValidKeyTimestamp;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.client;
package org.apache.fineract.cn.anubis.api.v1.client;

import feign.Feign;
import feign.gson.GsonDecoder;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import com.google.gson.annotations.SerializedName;

@@ -16,9 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import io.mifos.anubis.api.v1.validation.ValidKeyTimestamp;
import org.apache.fineract.cn.anubis.api.v1.validation.ValidKeyTimestamp;

import javax.validation.Valid;
import java.util.Objects;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import javax.validation.constraints.NotNull;
import java.math.BigInteger;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import java.util.List;
import java.util.Objects;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.domain;
package org.apache.fineract.cn.anubis.api.v1.domain;

import java.util.Objects;
import java.util.Set;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.validation;
package org.apache.fineract.cn.anubis.api.v1.validation;


import javax.validation.ConstraintValidator;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.validation;
package org.apache.fineract.cn.anubis.api.v1.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis.api.v1.validation;
package org.apache.fineract.cn.anubis.api.v1.validation;

import org.apache.fineract.cn.lang.DateConverter;
import org.junit.Assert;
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.example.noinitialize.Example;
import io.mifos.anubis.example.noinitialize.ExampleConfiguration;
import io.mifos.anubis.suites.SuiteTestEnvironment;
import org.apache.fineract.cn.anubis.example.noinitialize.Example;
import org.apache.fineract.cn.anubis.example.noinitialize.ExampleConfiguration;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +43,7 @@
public class AbstractNoInitializeTest extends SuiteTestEnvironment {
private static final String LOGGER_QUALIFIER = "test-logger";
@Configuration
@EnableFeignClients(basePackages = {"io.mifos.anubis.example.noinitialize"})
@EnableFeignClients(basePackages = {"org.apache.fineract.cn.anubis.example.noinitialize"})
@RibbonClient(name = APP_NAME)
@Import({ExampleConfiguration.class})
static public class TestConfiguration {
@@ -16,12 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.example.nokeystorage.Example;
import io.mifos.anubis.example.nokeystorage.ExampleConfiguration;
import io.mifos.anubis.example.simple.MetricsFeignClient;
import io.mifos.anubis.suites.SuiteTestEnvironment;
import org.apache.fineract.cn.anubis.example.nokeystorage.Example;
import org.apache.fineract.cn.anubis.example.nokeystorage.ExampleConfiguration;
import org.apache.fineract.cn.anubis.example.simple.MetricsFeignClient;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,7 +53,7 @@ public class AbstractNoKeyStorageTest extends SuiteTestEnvironment {
private static final String LOGGER_QUALIFIER = "test-logger";

@Configuration
@EnableFeignClients(clients = {io.mifos.anubis.example.nokeystorage.Example.class, MetricsFeignClient.class})
@EnableFeignClients(clients = {org.apache.fineract.cn.anubis.example.nokeystorage.Example.class, MetricsFeignClient.class})
@RibbonClient(name = APP_NAME)
@Import({ExampleConfiguration.class})
static public class TestConfiguration {
@@ -16,12 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.example.simple.Example;
import io.mifos.anubis.example.simple.ExampleConfiguration;
import io.mifos.anubis.suites.SuiteTestEnvironment;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.anubis.example.simple.Example;
import org.apache.fineract.cn.anubis.example.simple.ExampleConfiguration;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@ -46,7 +47,7 @@ public class AbstractSimpleTest extends SuiteTestEnvironment {
private static final String LOGGER_QUALIFIER = "test-logger";

@Configuration
@EnableFeignClients(basePackages = {"io.mifos.anubis.example.simple"})
@EnableFeignClients(basePackages = {"org.apache.fineract.cn.anubis.example.simple"})
@RibbonClient(name = APP_NAME)
@Import({ExampleConfiguration.class})
public static class TestConfiguration {
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.client.AnubisApiFactory;
import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.anubis.api.v1.domain.Signature;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
package org.apache.fineract.cn.anubis;

import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.client.AnubisApiFactory;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.anubis.suites.SuiteTestEnvironment;
import org.apache.fineract.cn.api.context.AutoSeshat;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.InvalidTokenException;
@@ -42,17 +43,18 @@ public class TestAnubisInitialize extends AbstractSimpleTest {
@Test
public void testBrokenToken()
{
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer)) {
example.uninitialize(); //make sure the internal initialize variable isn't set before we start.

final String brokenSeshatToken = "hmmmm, this doesn't look like a token?";

try {

final Anubis anubis = AnubisApiFactory.create(testEnvironment.serverURI(), logger);
final Anubis anubis = AnubisApiFactory.create(SuiteTestEnvironment.testEnvironment.serverURI(), logger);

try (final AutoSeshat ignored2 = new AutoSeshat(brokenSeshatToken)) {
final TenantApplicationSecurityEnvironmentTestRule securityMock = new TenantApplicationSecurityEnvironmentTestRule(testEnvironment);
final TenantApplicationSecurityEnvironmentTestRule securityMock = new TenantApplicationSecurityEnvironmentTestRule(
SuiteTestEnvironment.testEnvironment);

final String keyTimestamp = securityMock.getSystemSecurityEnvironment().tenantKeyTimestamp();
final RSAPublicKey publicKey = securityMock.getSystemSecurityEnvironment().tenantPublicKey();
@@ -71,14 +73,16 @@ public void testBrokenToken()

@Test
public void testHappyCase() {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(
SuiteTestEnvironment.cassandraInitializer)) {
initialize();
}
}

@Test
public void testReinitialize() {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(
SuiteTestEnvironment.cassandraInitializer)) {

initialize();

@@ -89,11 +93,13 @@ public void testReinitialize() {
@Test
public void testTwoTenants() {

try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(
SuiteTestEnvironment.cassandraInitializer)) {
initialize();
}

try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(
SuiteTestEnvironment.cassandraInitializer)) {
initialize();
}
}
@@ -114,10 +120,12 @@ public void testNonExistentTenant() {

@Test(expected = InvalidTokenException.class)
public void testAuthenticateWithoutInitialize() {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(cassandraInitializer)) {
try (final TenantDataStoreTestContext ignored = TenantDataStoreTestContext.forRandomTenantName(
SuiteTestEnvironment.cassandraInitializer)) {

final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
= new TenantApplicationSecurityEnvironmentTestRule(testEnvironment);
= new TenantApplicationSecurityEnvironmentTestRule(
SuiteTestEnvironment.testEnvironment);
final String permissionToken = tenantApplicationSecurityEnvironment.getPermissionToken("bubba", "foo", AllowedOperation.READ);
try (final AutoUserContext ignored2 = new AutoUserContext("bubba", permissionToken)) {
Assert.assertFalse(example.foo());
@@ -128,7 +136,7 @@ public void testAuthenticateWithoutInitialize() {

private void initialize() {
final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
= new TenantApplicationSecurityEnvironmentTestRule(testEnvironment);
= new TenantApplicationSecurityEnvironmentTestRule(SuiteTestEnvironment.testEnvironment);
tenantApplicationSecurityEnvironment.initializeTenantInApplication();

try (final AutoUserContext ignored = tenantApplicationSecurityEnvironment.createAutoUserContext("x")) {
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.example.simple.Metrics;
import io.mifos.anubis.example.simple.MetricsFeignClient;
import io.mifos.anubis.test.v1.SystemSecurityEnvironment;
import org.apache.fineract.cn.anubis.example.simple.Metrics;
import org.apache.fineract.cn.anubis.example.simple.MetricsFeignClient;
import org.apache.fineract.cn.anubis.test.v1.SystemSecurityEnvironment;
import org.apache.fineract.cn.api.context.AutoGuest;
import org.apache.fineract.cn.api.context.AutoSeshat;
import org.apache.fineract.cn.api.context.AutoUserContext;
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.api.v1.domain.ApplicationSignatureSet;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.anubis.api.v1.domain.ApplicationSignatureSet;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.junit.Assert;
import org.junit.Test;

@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.domain.ApplicationSignatureSet;
import io.mifos.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.domain.ApplicationSignatureSet;
import org.apache.fineract.cn.anubis.api.v1.domain.Signature;
import org.apache.fineract.cn.api.context.AutoSeshat;
import org.apache.fineract.cn.api.util.NotFoundException;
import org.apache.fineract.cn.lang.security.RsaKeyPairFactory;
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.api.v1.domain.AllowedOperation;
import io.mifos.anubis.example.noinitialize.UserContext;
import io.mifos.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.anubis.api.v1.domain.AllowedOperation;
import org.apache.fineract.cn.anubis.example.noinitialize.UserContext;
import org.apache.fineract.cn.anubis.test.v1.TenantApplicationSecurityEnvironmentTestRule;
import org.apache.fineract.cn.api.context.AutoSeshat;
import org.apache.fineract.cn.api.context.AutoUserContext;
import org.apache.fineract.cn.api.util.InvalidTokenException;
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
package io.mifos.anubis;
package org.apache.fineract.cn.anubis;

import io.mifos.anubis.api.v1.client.Anubis;
import io.mifos.anubis.api.v1.client.AnubisApiFactory;
import io.mifos.anubis.api.v1.domain.PermittableEndpoint;
import org.apache.fineract.cn.anubis.api.v1.client.Anubis;
import org.apache.fineract.cn.anubis.api.v1.client.AnubisApiFactory;
import org.apache.fineract.cn.anubis.api.v1.domain.PermittableEndpoint;
import org.junit.Assert;
import org.junit.Test;

0 comments on commit 9234554

Please sign in to comment.