Various changes to get Rhythm working in integration test.
diff --git a/component-test/src/main/java/io/mifos/rhythm/AbstractRhythmTest.java b/component-test/src/main/java/io/mifos/rhythm/AbstractRhythmTest.java
index 0694006..dad54b1 100644
--- a/component-test/src/main/java/io/mifos/rhythm/AbstractRhythmTest.java
+++ b/component-test/src/main/java/io/mifos/rhythm/AbstractRhythmTest.java
@@ -23,7 +23,6 @@
import io.mifos.core.test.fixture.mariadb.MariaDBInitializer;
import io.mifos.core.test.listener.EnableEventRecording;
import io.mifos.core.test.listener.EventRecorder;
-import io.mifos.identity.api.v1.client.IdentityManager;
import io.mifos.rhythm.api.v1.client.RhythmManager;
import io.mifos.rhythm.api.v1.domain.Beat;
import io.mifos.rhythm.api.v1.events.BeatEvent;
@@ -112,9 +111,6 @@
@MockBean
BeatPublisherService beatPublisherServiceSpy;
- @MockBean
- IdentityManager identityManager;
-
@Before
public void prepTest() {
userContext = tenantApplicationSecurityEnvironment.createAutoUserContext(TEST_USER);
diff --git a/service/src/main/java/io/mifos/rhythm/service/RhythmApplication.java b/service/src/main/java/io/mifos/rhythm/service/RhythmApplication.java
new file mode 100644
index 0000000..fa6f5ec
--- /dev/null
+++ b/service/src/main/java/io/mifos/rhythm/service/RhythmApplication.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.rhythm.service;
+
+import org.springframework.boot.SpringApplication;
+
+/**
+ * @author Myrle Krantz
+ */
+public class RhythmApplication {
+
+ public RhythmApplication() {
+ super();
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(RhythmConfiguration.class, args);
+ }
+}
diff --git a/service/src/main/java/io/mifos/rhythm/service/internal/service/BeatPublisherService.java b/service/src/main/java/io/mifos/rhythm/service/internal/service/BeatPublisherService.java
index 9a742ea..6495db2 100644
--- a/service/src/main/java/io/mifos/rhythm/service/internal/service/BeatPublisherService.java
+++ b/service/src/main/java/io/mifos/rhythm/service/internal/service/BeatPublisherService.java
@@ -26,6 +26,7 @@
import io.mifos.permittedfeignclient.service.ApplicationAccessTokenService;
import io.mifos.rhythm.service.config.RhythmProperties;
import io.mifos.rhythm.service.internal.identity.ApplicationPermissionRequestCreator;
+import io.mifos.rhythm.spi.v1.PermittableGroupIds;
import io.mifos.rhythm.spi.v1.client.BeatListener;
import io.mifos.rhythm.spi.v1.domain.BeatPublish;
import org.slf4j.Logger;
@@ -88,7 +89,7 @@
public Optional<String> requestPermissionForBeats(final String tenantIdentifier, final String applicationName) {
try (final AutoTenantContext ignored = new AutoTenantContext(tenantIdentifier)) {
try (final AutoUserContext ignored2 = new AutoUserContext(properties.getUser(), "")) {
- final String consumerPermittableGroupIdentifier = getPermittableGroupIdentifier(applicationName);
+ final String consumerPermittableGroupIdentifier = PermittableGroupIds.forApplication(applicationName);
final Permission publishBeatPermission = new Permission();
publishBeatPermission.setAllowedOperations(Collections.singleton(AllowedOperation.CHANGE));
publishBeatPermission.setPermittableEndpointGroupIdentifier(consumerPermittableGroupIdentifier);
@@ -105,10 +106,6 @@
}
}
- private static String getPermittableGroupIdentifier(final String beatConsumingApplicationName) {
- return beatConsumingApplicationName.replace("-", "__") + "__khepri";
- }
-
/**
* Authenticate with identity and publish the beat to the application. This function performs all the scheduled
* interprocess communication in rhythm, and therefore most be mocked in unit and component tests.
diff --git a/service/src/main/resources/logback.xml b/service/src/main/resources/logback.xml
new file mode 100644
index 0000000..16f5144
--- /dev/null
+++ b/service/src/main/resources/logback.xml
@@ -0,0 +1,55 @@
+<!--
+
+ Copyright 2017 The Mifos Initiative.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<configuration>
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>logs/rhythm.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>rhythm.%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>7</maxHistory>
+ <totalSizeCap>2GB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="com" level="INFO">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org" level="INFO">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="io" level="INFO">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="net" level="INFO">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <root level="DEBUG">
+ <appender-ref ref="FILE"/>
+ </root>
+</configuration>
\ No newline at end of file
diff --git a/shared.gradle b/shared.gradle
index bd72434..dc7dd71 100644
--- a/shared.gradle
+++ b/shared.gradle
@@ -1,5 +1,5 @@
group 'io.mifos.rhythm'
-version '0.1.0.BUILD-SNAPSHOT'
+version '0.1.0-BUILD-SNAPSHOT'
ext.versions = [
frameworkapi : '0.1.0-BUILD-SNAPSHOT',
diff --git a/spi/src/main/java/io/mifos/rhythm/spi/v1/PermittableGroupIds.java b/spi/src/main/java/io/mifos/rhythm/spi/v1/PermittableGroupIds.java
new file mode 100644
index 0000000..cd2a35c
--- /dev/null
+++ b/spi/src/main/java/io/mifos/rhythm/spi/v1/PermittableGroupIds.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.rhythm.spi.v1;
+
+/**
+ * @author Myrle Krantz
+ */
+@SuppressWarnings("unused")
+public interface PermittableGroupIds {
+ static String forApplication(final String beatConsumingApplicationName) {
+ return beatConsumingApplicationName.replace("-", "__") + "__khepri";
+ }
+}