Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
sample module to build api jars for JSON encoding/decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Feb 26, 2015
1 parent 8966d51 commit cb73de7
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 1 deletion.
75 changes: 75 additions & 0 deletions modules/json/metrics/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.hawkular</groupId>
<artifactId>hawkular</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

<artifactId>hawkular-metrics-message-api</artifactId>
<name>Hawkular Metrics Message API</name>
<description>JSON Schema/Java API for metrics messages.</description>

<dependencies>
<dependency>
<groupId>org.hawkular.bus</groupId>
<artifactId>hawkular-bus-common</artifactId>
<version>${version.org.hawkular.bus}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.4.7</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>org.hawkular.message.metric</targetPackage>
<annotationStyle>gson</annotationStyle>
<includeToString>false</includeToString>
<includeHashcodeAndEquals>false</includeHashcodeAndEquals>
<initializeCollections>true</initializeCollections>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"type": "object",
"extends": {
"type": "object",
"javaType": "org.hawkular.bus.common.BasicMessage"
},
"javaType": "org.hawkular.message.metrics.MetricData",
"properties": {
"timestamp": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": ["timestamp", "value"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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 org.hawkular.message.metrics;

import java.util.Date;

import org.junit.Test;

public class MetricDataTest {
@Test
public void testMetricData() {
MetricData metricData = new MetricData();
metricData.setValue("123");
metricData.setTimestamp(String.valueOf(new Date().getTime()));
assert null != metricData.toJSON();
System.out.println(metricData.toJSON());
}
}
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.hawkular</groupId>
<artifactId>hawkular-parent</artifactId>
<version>7</version>
<version>8</version>
</parent>

<artifactId>hawkular</artifactId>
Expand Down Expand Up @@ -55,6 +55,7 @@
<modules>
<module>ui/console</module>
<module>modules/pinger</module>
<module>modules/json/metrics</module>
<module>kettle</module>
</modules>

Expand Down Expand Up @@ -83,6 +84,7 @@
<version.gnu.getopt>1.0.13</version.gnu.getopt>
<version.org.apache.activemq>5.10.0</version.org.apache.activemq>
<version.org.testng>6.5.2</version.org.testng>
<version.org.hawkular.bus>1.0.0-SNAPSHOT</version.org.hawkular.bus>
<version.org.wildfly>8.2.0.Final</version.org.wildfly>

</properties>
Expand Down

0 comments on commit cb73de7

Please sign in to comment.