Skip to content

Commit

Permalink
bug fixes, added sonar, minor dashboard improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
pang committed Aug 27, 2019
1 parent 44ea967 commit 8c7b4e5
Show file tree
Hide file tree
Showing 15 changed files with 221 additions and 81 deletions.
21 changes: 12 additions & 9 deletions Billing/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<a href="http://icclab.github.io/cyclops" target="_blank"><img align="middle" src="http://icclab.github.io/cyclops/assets/images/logo_big.png"></img></a>

## Billing micro service
## Billing micro service
[![Reliability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.billing%3Acyclops-billing&metric=reliability_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.billing%3Acyclops-billing)
[![Maintainability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.billing%3Acyclops-billing&metric=sqale_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.billing%3Acyclops-billing)

Billing micro service as part of RCB Cyclops.

### Configuration
Expand All @@ -10,37 +13,37 @@ For Billing micro service to function properly you will need to edit <code>confi
To have the logging system enabled you need to run the following:

./scripts/logging.sh

Then all Billing micro service logs will be stored in <code>/var/log/cyclops/billing/</code> directory.

### Run the JAR file
In order to run Billing micro service as embedded JAR you need to have Java 8 installed and execute:

java -jar bin/billing.jar config/billing.conf [port]

If you don't want to use the default port from configuration file, you can optionally specify one by adding it as parameter.

### Compile from the source code
If you want to compile the code on your own and your environment already has Java 8 and Maven 3 present, simply execute the following commands:

cd scripts
./compile.sh

You will find the compiled JAR embedded file in the <code>bin</code> subdirectory.

### Documentation
You can find the API reference and developer's guide, as well as troubleshooting page in the Wiki section.

### License

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.
under the License.
24 changes: 24 additions & 0 deletions Billing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
</plugins>
</build>
<repositories>
Expand Down Expand Up @@ -256,5 +261,24 @@
<artifactId>okhttp</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://kafka.cloudlab.zhaw.ch:9000
</sonar.host.url>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ public class DeleteBills extends Command{
@Override
Status execute() {
Status status = new Status();
DeleteQuery delete = null;
try {
DbAccess db = new DbAccess();

// select time_from Bill table
DeleteQuery delete = db.createDeleteFrom(Bill.TABLE);
delete = db.createDeleteFrom(Bill.TABLE);

// time window selection
delete.addConditions(Bill.TIME_FROM_FIELD.ge(inline(new Timestamp(time_from))));
Expand All @@ -68,6 +69,9 @@ Status execute() {
} catch (Exception e) {
CommandLogger.log(e.getMessage());
status.setServerError(e.getMessage());
} finally{
assert delete != null;
delete.close();
}

return status;
Expand Down
21 changes: 12 additions & 9 deletions CDR/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<a href="http://icclab.github.io/cyclops" target="_blank"><img align="middle" src="http://icclab.github.io/cyclops/assets/images/logo_big.png"></img></a>

## CDR micro service
## CDR micro service
[![Reliability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.cdr%3Acyclops-cdr&metric=reliability_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.cdr%3Acyclops-cdr)
[![Maintainability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.cdr%3Acyclops-cdr&metric=sqale_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.cdr%3Acyclops-cdr)

Charge Data Records micro service as part of RCB Cyclops.

### Configuration
Expand All @@ -10,37 +13,37 @@ For CDR micro service to function properly you will need to edit <code>config/cd
To have the logging system enabled you need to run the following:

./scripts/logging.sh

Then all cdr micro service logs will be stored in <code>/var/log/cyclops/cdr/</code> directory.

### Run the JAR file
In order to run CDR micro service as embedded JAR you need to have Java 8 installed and execute:

java -jar bin/cdr.jar config/cdr.conf [port]

If you don't want to use the default port from configuration file, you can optionally specify one by adding it as parameter.

### Compile from the source code
If you want to compile the code on your own and your environment already has Java 8 and Maven 3 present, simply execute the following commands:

cd scripts
./compile.sh

You will find the compiled JAR embedded file in the <code>bin</code> subdirectory.

### Documentation
You can find the API reference and developer's guide, as well as troubleshooting page in the Wiki section.

### License

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.
under the License.
29 changes: 29 additions & 0 deletions CDR/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
</plugins>
</build>
<repositories>
Expand Down Expand Up @@ -246,5 +251,29 @@
<artifactId>disruptor</artifactId>
<version>${lmax-version}</version>
</dependency>
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</dependency>
</dependencies>





<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
http://kafka.cloudlab.zhaw.ch:9000
</sonar.host.url>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.ArrayList;
import java.util.List;

import static org.jooq.impl.DSL.delete;
import static org.jooq.impl.DSL.inline;

public class DeleteCDRs extends Command {
Expand All @@ -43,11 +44,12 @@ public class DeleteCDRs extends Command {
@Override
Status execute() {
Status status = new Status();
DeleteQuery delete = null;
try {
DbAccess db = new DbAccess();

// select time_from CDR table
DeleteQuery delete = db.createDeleteFrom(CDR.TABLE);
delete = db.createDeleteFrom(CDR.TABLE);

// time window selection
delete.addConditions(CDR.TIME_FROM_FIELD.ge(inline(new Timestamp(time_from))));
Expand All @@ -67,6 +69,9 @@ Status execute() {
} catch (Exception e) {
CommandLogger.log(e.getMessage());
status.setServerError(e.getMessage());
} finally{
assert delete != null;
delete.close();
}

return status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ public List<String> getAccounts() {
@Override
Status execute(){
Status status = new Status();

SelectQuery select = null;
try {
// sanity checks first
Condition accountCondition = sanityCheckAndWhereAccounts();

DbAccess db = new DbAccess();

// select time_from CDR table
SelectQuery select = db.createSelectFrom(CDR.TABLE, inline(run).as("run"), CDR.METRIC_FIELD, CDR.ACCOUNT_FIELD, CDR.TIME_FROM_FIELD, CDR.TIME_TO_FIELD,
select = db.createSelectFrom(CDR.TABLE, inline(run).as("run"), CDR.METRIC_FIELD, CDR.ACCOUNT_FIELD, CDR.TIME_FROM_FIELD, CDR.TIME_TO_FIELD,
CDR.CHARGE_FIELD, CDR.CURRENCY_FIELD, CDR.DATA_FIELD);

// time window selection
Expand Down Expand Up @@ -149,6 +149,9 @@ Status execute(){
} catch (Exception e) {
CommandLogger.log(e.getMessage());
status.setServerError(e.getMessage());
} finally {
assert select != null;
select.close();
}

return status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public List<String> getAccounts() {
@Override
Status execute(){
Status status = new Status();

SelectQuery select = null;
try {
// sanity checks first
Condition accountCondition = sanityCheckAndWhereAccounts();

DbAccess db = new DbAccess();

// select time_from CDR table
SelectQuery select = db.createSelectFrom(CDR.TABLE, CDR.METRIC_FIELD, CDR.ACCOUNT_FIELD, CDR.TIME_FROM_FIELD, CDR.TIME_TO_FIELD,
select = db.createSelectFrom(CDR.TABLE, CDR.METRIC_FIELD, CDR.ACCOUNT_FIELD, CDR.TIME_FROM_FIELD, CDR.TIME_TO_FIELD,
CDR.CHARGE_FIELD, CDR.CURRENCY_FIELD, CDR.DATA_FIELD);

// time window selection
Expand Down Expand Up @@ -142,6 +142,9 @@ Status execute(){
} catch (Exception e) {
CommandLogger.log(e.getMessage());
status.setServerError(e.getMessage());
} finally{
assert select != null;
select.close();
}

return status;
Expand Down
19 changes: 11 additions & 8 deletions Coin/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<a href="http://icclab.github.io/cyclops" target="_blank"><img align="middle" src="http://icclab.github.io/cyclops/assets/images/logo_big.png"></img></a>

## Rule engine micro service
[![Reliability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.coin%3Acyclops-coin&metric=reliability_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.coin%3Acyclops-coin)
[![Reliability Rating](http://kafka.cloudlab.zhaw.ch:9000/api/project_badges/measure?project=ch.icclab.cyclops.coin%3Acyclops-coin&metric=reliability_rating)](http://kafka.cloudlab.zhaw.ch:9000/dashboard?id=ch.icclab.cyclops.coin%3Acyclops-coin)

This micro service (aka Coin) is a generic business rule system that is internally utilising <a href="http://drools.org" target="_blank">Drools</a>, an inference engine, for its rule execution. The micro service itself exposes template instantiation, as well as truth maintenance over RESTful APIs, and therefore allow developers to write their own business rules and provide graphical user interfaces for people from sales to work with.

The most prominent features:
Expand All @@ -21,29 +24,29 @@ The most prominent features:
- Stream processing
- Alarm notifications
- Batch processing
- Easy debugging
- Easy debugging
- State recovery

### Logging
To have the logging system enabled you need to run the following:

./scripts/logging.sh

Then all Rule engine service logs will be stored in <code>/var/log/cyclops/coin/</code> directory.

### Run the JAR file
In order to run Rule ngine micro service as embedded JAR you need to have Java 8 installed and execute:

java -jar bin/coin.jar config/coin.conf [port]

If you don't want to use the default port from configuration file, you can optionally specify one by adding it as parameter.

### Compile from the source code
If you want to compile the code on your own and your environment already has Java 8 and Maven 3 present, simply execute the following commands:

cd scripts
./compile.sh

You will find the compiled JAR embedded file in the <code>bin</code> subdirectory.

### Scripting
Expand All @@ -62,15 +65,15 @@ If you decide to automate deployment of the Rule engine micro service, please no
For API reference guide, as well as documentation please consult <code>documentation</code> folder.

### License

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.
under the License.
Loading

0 comments on commit 8c7b4e5

Please sign in to comment.