Java Code Examples for com.mongodb.BasicDBObject#getInt()

The following examples show how to use com.mongodb.BasicDBObject#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TransmitterRawData.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public TransmitterRawData(BasicDBObject src) {
	TransmissionId = src.getInt("TransmissionId");
	TransmitterId  = src.getString("TransmitterId");
	RawValue       = src.getInt("RawValue");
	FilteredValue  = src.getInt("FilteredValue");
	BatteryLife    = src.getInt("BatteryLife");
	ReceivedSignalStrength = src.getInt("ReceivedSignalStrength");
	CaptureDateTime = src.getLong("CaptureDateTime");
	UploaderBatteryLife = src.getInt("UploaderBatteryLife");
}
 
Example 2
Source File: LibreWifiData.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public LibreWifiData(BasicDBObject src) {

        BlockBytes = src.getString("BlockBytes");
        CaptureDateTime = src.getLong("CaptureDateTime");
        ChecksumOk = src.getInt("ChecksumOk");
        DebugInfo = src.getString("DebugInfo");
        TomatoBatteryLife = src.getInt("TomatoBatteryLife");
        UploaderBatteryLife = src.getInt("UploaderBatteryLife");
        Uploaded = src.getInt("Uploaded");
        HwVersion = src.getString("HwVersion");
        FwVersion = src.getString("FwVersion");
        SensorId = src.getString("SensorId");
        patchUid = src.getString("patchUid");
        patchInfo = src.getString("patchInfo");
    }
 
Example 3
Source File: TransmitterRawData.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public TransmitterRawData(BasicDBObject src) {
	TransmissionId = src.getInt("TransmissionId");
	TransmitterId  = src.getString("TransmitterId");
	RawValue       = src.getInt("RawValue");
	FilteredValue  = src.getInt("FilteredValue");
	BatteryLife    = src.getInt("BatteryLife");
	ReceivedSignalStrength = src.getInt("ReceivedSignalStrength");
	CaptureDateTime = src.getLong("CaptureDateTime");
	UploaderBatteryLife = src.getInt("UploaderBatteryLife");
}
 
Example 4
Source File: LibreWifiData.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
public LibreWifiData(BasicDBObject src) {

        BlockBytes = src.getString("BlockBytes");
        CaptureDateTime = src.getLong("CaptureDateTime");
        ChecksumOk = src.getInt("ChecksumOk");
        DebugInfo = src.getString("DebugInfo");
        TomatoBatteryLife = src.getInt("TomatoBatteryLife");
        UploaderBatteryLife = src.getInt("UploaderBatteryLife");
        Uploaded = src.getInt("Uploaded");
        HwVersion = src.getString("HwVersion");
        FwVersion = src.getString("FwVersion");
        SensorId = src.getString("SensorId");
        patchUid = src.getString("patchUid");
        patchInfo = src.getString("patchInfo");
    }
 
Example 5
Source File: TransmitterRawData.java    From xDrip-Experimental with GNU General Public License v3.0 5 votes vote down vote up
public TransmitterRawData(BasicDBObject src) {
	TransmissionId = src.getInt("TransmissionId");
	TransmitterId  = src.getString("TransmitterId");
	RawValue       = src.getInt("RawValue");
	FilteredValue  = src.getInt("FilteredValue");
	BatteryLife    = src.getInt("BatteryLife");
	ReceivedSignalStrength = src.getInt("ReceivedSignalStrength");
	CaptureDateTime = src.getLong("CaptureDateTime");
	UploaderBatteryLife = src.getInt("UploaderBatteryLife");
}
 
Example 6
Source File: TransmitterRawData.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
public TransmitterRawData(BasicDBObject src) {
	TransmissionId = src.getInt("TransmissionId");
	TransmitterId  = src.getString("TransmitterId");
	RawValue       = src.getInt("RawValue");
	FilteredValue  = src.getInt("FilteredValue");
	BatteryLife    = src.getInt("BatteryLife");
	ReceivedSignalStrength = src.getInt("ReceivedSignalStrength");
	CaptureDateTime = src.getLong("CaptureDateTime");
	UploaderBatteryLife = src.getInt("UploaderBatteryLife");
}
 
Example 7
Source File: RollupStorageTest.java    From hvdf with Apache License 2.0 5 votes vote down vote up
@Test
public void testRollupCountField() throws Exception {

	long sampleTime = TimeUnit.MINUTES.toMillis(1);
	int testSize = 10000;
	
	String configPath = "plugin_config/rollup_max_min_count.json";
	Channel channel = getConfiguredChannel(configPath);
	
	for(int i=0; i < testSize; i++){
 	BasicDBObject sample = new BasicDBObject(Sample.TS_KEY, i*sampleTime);
 	sample.append(Sample.DATA_KEY, new BasicDBObject("v", (testSize - i)));
 	sample.append(Sample.SOURCE_KEY, "sensor1");
 	channel.pushSample(sample, false, new BasicDBList());
	}
	
	
	// get all the rollup documents
	List<Sample> samples = channel.query(null, TimeUnit.MINUTES.toMillis(testSize), 
			TimeUnit.MINUTES.toMillis(testSize), null, null, testSize);
	
	// Each document is 60 samples, may be a partial document at end
	assertEquals((testSize/60) + (testSize%60 > 0 ? 1 : 0), samples.size());
	
	int totalRollupCount = 0;
	for(Sample rollupDoc : samples){
		BasicDBObject v = (BasicDBObject)rollupDoc.getData().get("v");
		totalRollupCount += (int)v.getInt("count");
	}
	
	assertEquals(testSize, totalRollupCount);    	
}
 
Example 8
Source File: RollupStorageTest.java    From hvdf with Apache License 2.0 4 votes vote down vote up
@Test
public void testRollupGroupCountField() throws Exception {

	long sampleTime = TimeUnit.MINUTES.toMillis(1);
	int testSize = 10000;
	
	String configPath = "plugin_config/rollup_group_count.json";
	Channel channel = getConfiguredChannel(configPath);
	
	for(int i=0; i < testSize; i++){
 	BasicDBObject sample = new BasicDBObject(Sample.TS_KEY, i*sampleTime);
 	sample.append(Sample.DATA_KEY, new BasicDBObject("v", i%25));
 	sample.append(Sample.SOURCE_KEY, "sensor1");
 	channel.pushSample(sample, false, new BasicDBList());
	}
	    	
	// get all the rollup documents
	List<Sample> samples = channel.query(null, TimeUnit.MINUTES.toMillis(testSize), 
			TimeUnit.MINUTES.toMillis(testSize), null, null, testSize);
	
	// Each document is 60 samples, may be a partial document at end
	assertEquals((testSize/60) + (testSize%60 > 0 ? 1 : 0), samples.size());
	
	int totalRollupCount = 0;
	for(Sample rollupDoc : samples){
		
		// For each doc, ensure the group count total matches the sample total
		BasicDBObject v = (BasicDBObject)rollupDoc.getData().get("v");
		int rollupCount = v.getInt("count");
		BasicDBObject groups = (BasicDBObject)v.get("group_count");
		int localTotal = 0;
		for(String groupKey : groups.keySet()){
			localTotal += groups.getInt(groupKey);
		}
		
    	assertEquals(rollupCount, localTotal);    	    		
		totalRollupCount += localTotal;
	}
	
	assertEquals(testSize, totalRollupCount);    	
}