本文整理汇总了Java中org.jrobin.core.Sample.setAndUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java Sample.setAndUpdate方法的具体用法?Java Sample.setAndUpdate怎么用?Java Sample.setAndUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jrobin.core.Sample
的用法示例。
在下文中一共展示了Sample.setAndUpdate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEntriesZeroTo100InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testEntriesZeroTo100InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(105); //Make sure all entries are recorded (5 is just a buffer for consolidation)
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<100; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + i);
}
rrd.close();
prepareGraph();
expectMinorGridLines(4);
expectMajorGridLine(" 50");
expectMinorGridLines(4);
expectMajorGridLine(" 100");
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例2: testEntriesNeg50To0InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testEntriesNeg50To0InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(100);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<50; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + (i -50));
}
rrd.close();
prepareGraph();
expectMinorGridLines(2);
expectMajorGridLine(" -40");
expectMinorGridLines(3);
expectMajorGridLine(" -20");
expectMinorGridLines(3);
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例3: testRrdUpdate
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testRrdUpdate() throws Exception {
Sample sample = null;
long startTime = System.currentTimeMillis() - 1000;
// for (int i = 0; i < 1000000; i++) {
sample = m_db.createSample();
sample.setAndUpdate(startTime + ":" + m_random.nextInt());
//sample.setAndUpdate(startTime++ + ":" + m_random.nextInt());
// }
}
示例4: testOneEntryInRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testOneEntryInRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(100);
RrdDb rrd = new RrdDb(jrbFileName);
long nowSeconds = new Date().getTime();
long fiveMinutesAgo = nowSeconds - (5 * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(fiveMinutesAgo+":10");
rrd.close();
prepareGraph();
checkForBasicGraph();
}
示例5: testTwoEntriesInRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testTwoEntriesInRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(100);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<2; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp+":100");
}
rrd.close();
prepareGraph();
expectMajorGridLine(" 90");
expectMinorGridLines(1);
expectMajorGridLine(" 100");
expectMinorGridLines(1);
expectMajorGridLine(" 110");
expectMinorGridLines(1);
expectMajorGridLine(" 120");
expectMinorGridLines(1);
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例6: testEntriesNeg50To100InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testEntriesNeg50To100InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(155);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<150; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + (i -50));
}
rrd.close();
prepareGraph();
expectMajorGridLine(" -50");
expectMinorGridLines(4);
expectMajorGridLine(" 0");
expectMinorGridLines(4);
expectMajorGridLine(" 50");
expectMinorGridLines(4);
expectMajorGridLine(" 100");
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例7: testEntriesNeg55To105InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
@Test
public void testEntriesNeg55To105InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(165);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<160; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + (i -55));
}
rrd.close();
prepareGraph();
/**
* Prior to JRB-12 fix, this was the behaviour. Note the lack of a decent negative label
expectMinorGridLines(3);
expectMajorGridLine(" 0");
expectMinorGridLines(4);
expectMajorGridLine(" 100");
expectMinorGridLines(1);
*/
//New behaviour is better; no minor grid lines, which is interesting, but much better representation
expectMajorGridLine(" -50");
expectMajorGridLine(" 0");
expectMajorGridLine(" 50");
expectMajorGridLine(" 100");
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例8: testEntriesNeg80To90InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
/**
* Test specifically for JRB-12 (http://issues.opennms.org/browse/JRB-12)
* In the original, when the values go from -80 to 90 on a default height graph
* (i.e. limited pixels available for X-axis labelling),ValueAxis gets all confused
* and decides it can only display "0" on the X-axis (there's not enough pixels
* for more labels, and none of the Y-label factorings available work well enough
* @throws FontFormatException
*/
@Test
public void testEntriesNeg80To90InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(180);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<170; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + (i -80));
}
rrd.close();
prepareGraph();
/**
* Original behaviour; a single major X-axis label (0) only.
expectMinorGridLines(4);
expectMajorGridLine(" 0");
expectMinorGridLines(4);
*/
//New behaviour post JRB-12 fix:
expectMajorGridLine(" -50");
expectMajorGridLine(" 0");
expectMajorGridLine(" 50");
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例9: testEntriesNeg80To80InRrd
import org.jrobin.core.Sample; //导入方法依赖的package包/类
/**
* Test specifically for JRB-12 (http://issues.opennms.org/browse/JRB-12)
* Related to testEntriesNeg80To90InRrd, except in the original code
* this produced sensible labelling. Implemented to check that the
* changes don't break the sanity.
* @throws FontFormatException
*/
@Test
public void testEntriesNeg80To80InRrd() throws IOException, RrdException, FontFormatException {
createGaugeRrd(180);
RrdDb rrd = new RrdDb(jrbFileName);
for(int i=0; i<160; i++) {
long timestamp = startTime + 1 + (i * 60);
Sample sample = rrd.createSample();
sample.setAndUpdate(timestamp + ":" + (i -80));
}
rrd.close();
prepareGraph();
// Original
expectMinorGridLines(3);
expectMajorGridLine(" -50");
expectMinorGridLines(4);
expectMajorGridLine(" 0");
expectMinorGridLines(4);
expectMajorGridLine(" 50");
expectMinorGridLines(3);
replay(imageWorker);
this.valueAxis.draw();
//Validate the calls to the imageWorker
verify(imageWorker);
}
示例10: updateFile
import org.jrobin.core.Sample; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* Creates a sample from the JRobin RrdDb and passes in the data provided.
*/
public void updateFile(final RrdDb rrdFile, final String owner, final String data) throws Exception {
Sample sample = rrdFile.createSample();
sample.setAndUpdate(data);
}