Skip to content

Instantly share code, notes, and snippets.

View jsanda's full-sized avatar

John Sanda jsanda

View GitHub Profile
(ns rhq.plugin
(:require [rhq.config :as config])
(:import [org.rhq.core.pluginapi.inventory
ResourceDiscoveryComponent ResourceDiscoveryContext ClassLoaderFacet
DiscoveredResourceDetails ResourceComponent ResourceContext]
[org.rhq.core.domain.measurement AvailabilityType])
(:gen-class
:name rhq.plugin.PluginComponent
:implements [org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent
org.rhq.core.pluginapi.inventory.ResourceComponent]))
(config [["my-map" {"username" "rhqadmin"
"password" "rhqadmin"}]
["hostname" "localhost"])
SliceQuery<String,Composite, Integer> sliceQuery = HFactory.createSliceQuery(keyspace, StringSerializer.get(),
new CompositeSerializer().get(), IntegerSerializer.get());
sliceQuery.setColumnFamily("metrics_work_queue");
sliceQuery.setKey("raw_metrics");
ColumnSliceIterator<String, Composite, Integer> iterator = new ColumnSliceIterator<String, Composite, Integer>(
sliceQuery, (Composite) null, (Composite) null, false);
assertTrue(iterator.hasNext());
HColumn<Composite, Integer> actualQueueValue = iterator.next();
private DateTime get6HourTimeSlice(DateTime dateTime) {
Chronology chronology = GregorianChronology.getInstance();
DateTimeField hourField = chronology.hourOfDay();
DividedDateTimeField dividedField = new DividedDateTimeField(hourField, DateTimeFieldType.clockhourOfDay(), 6);
long timestamp = dividedField.roundFloor(dateTime.getMillis());
return new DateTime(timestamp);
}
Failed tests: testSendSecureMessageClientAuthWantWithTruststore(org.rhq.enterprise.agent.AgentComm2Test): Failed to send command from agent1 to agent2: Command Response: isSuccessful=[false]; command=[null]; results=[null]; exception=[org.jboss.remoting.CannotConnectException:Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:22222/] -> java.lang.reflect.InvocationTargetException:null -> javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException: No trusted certificate found -> sun.security.validator.ValidatorException:No trusted certificate found]
testSendSecureMessageFullAuth(org.rhq.enterprise.agent.AgentComm2Test): Failed to send command from agent1 to agent2: Command Response: isSuccessful=[false]; command=[null]; results=[null]; exception=[org.jboss.remoting.CannotConnectException:Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:22222/] -> java.lang.ref
@jsanda
jsanda / gist:2921085
Created June 13, 2012 00:49
RHQ metrics domain model
public class MeasurementDataTrait extends MeasurementData {
@Column(length = 255)
private String value;
// rest omitted for brevity
}
@Entity
(ns rhq.plugin
(:require [rhq.config :as config])
(:import [org.rhq.core.pluginapi.inventory
ResourceDiscoveryComponent ResourceDiscoveryContext ClassLoaderFacet
DiscoveredResourceDetails ResourceComponent ResourceContext]
[org.rhq.core.domain.measurement AvailabilityType])
(:gen-class
:name rhq.plugin.PluginComponent
:implements [org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent
org.rhq.core.pluginapi.inventory.ResourceComponent]))
@jsanda
jsanda / gist:2921241
Created June 13, 2012 01:36
RHQ metrics domain model classes
public class MeasurementDataTrait extends MeasurementData {
@Column(length = 255)
private String value;
// rest omitted for brevity
}
@Entity
@jsanda
jsanda / hector_column_slice_npe.java
Created June 13, 2012 01:44
Hector's column slice iterator
SliceQuery<Integer, Double Long> query = HFactory.createSliceQuery(keyspace, IntegerSerializer.get(),
LongSerializer.get(), DoubleSerializer.get());
query.setColumnFamily(rawMetricsDataCF);
query.setKey(scheduleId);
ColumnSliceIterator<Integer, Double, Long> iterator = new ColumnSliceIterator<Integer, Double, Long>(
query, startTime.getMillis(), endTime.getMillis(), false);
HColumn<Long, Double> column = iterator.next();
@jsanda
jsanda / hector_column_slice_hack.java
Created June 13, 2012 01:46
Hector's column slice iterator hack
ColumnSliceIterator<Integer, Double, Long> iterator = new ColumnSliceIterator<Integer, Double, Long>(
query, startTime.getMillis(), endTime.getMillis(), false);
iterator.hasNext(); // call hasNext first to initialize internal iterator
HColumn<Long, Double> column = iterator.next();