Package wpn.hdri.ss.data

Examples of wpn.hdri.ss.data.Timestamp


*/
public class ReadAttributeTaskTest {
    @Test
    public void testCancellation() throws Exception {
        Client mockClient = mock(Client.class);
        stub(mockClient.readAttribute(null)).toReturn(new AbstractMap.SimpleEntry<java.lang.Object, wpn.hdri.ss.data.Timestamp>(null, new Timestamp(System.currentTimeMillis())));
        Attribute mockAttribute = mock(Attribute.class);
        Logger mockLogger = mock(Logger.class);

        ScheduledExecutorService singleThreadExecutor = Executors.newScheduledThreadPool(1);

View Full Code Here


        assertTrue(average < _100K);
    }

    @Test
    public void testGetSnapshot() {
        Timestamp timestamp = new Timestamp(System.currentTimeMillis() - 1000);
        for (int i = 0; i < _100K; i++) {
            engine.getValues(timestamp, AttributesManager.DEFAULT_ATTR_GROUP);
        }

        long start = System.nanoTime();
View Full Code Here

        assertTrue(average < _100K);
    }

    @Test
    public void testGetDataUpdates() {
        Timestamp timestamp = new Timestamp(System.currentTimeMillis() - 1000);
        for (int i = 0; i < _100K; i++) {
            engine.getAllAttributeValues(timestamp, AttributesManager.DEFAULT_ATTR_GROUP);
        }

View Full Code Here

            if (rc != TErrorList.success) {
                throw new RuntimeException("TLink has failed: " + TErrorList.getErrorString(rc));
            }
            TDataType dout = tLink.dOutput;
            long time = tLink.getLastTimeStamp();
            Timestamp timestamp = new Timestamp(time);
            return new AbstractMap.SimpleImmutableEntry<T, wpn.hdri.ss.data.Timestamp>((T) getDataObject(dout), timestamp);
        } catch (Exception e) {
            throw new ClientException("Read from " + getDeviceName() + "/" + attrName + " failed.", e);
        }
    }
View Full Code Here

     */
    @Override
    public <T> Map.Entry<T, Timestamp> readAttribute(String attrName) throws ClientException {
        try {
            Map.Entry<T, Long> entry = proxy.readAttributeValueAndTime(attrName);
            return new AbstractMap.SimpleImmutableEntry<T, Timestamp>(entry.getKey(), new Timestamp(entry.getValue()));
        } catch (TangoProxyException devFailed) {
            throw new ClientException("Exception in " + proxy.getName(), devFailed);
        }
    }
View Full Code Here

                return null;
            }

            Value<T> val = Value.getInstance(converter.convert(value));

            Timestamp read = Timestamp.fromString(Iterables.get(values, 4));
            Timestamp write = Timestamp.fromString(Iterables.get(values, 5));

            return newAttributeValue(dataName, alias, val, read, write);
        } catch (ClassNotFoundException e) {
            //TODO log
            return null;
View Full Code Here

    public void run() {
        long totalSize = attributesManager.size();

        if (totalSize < threshold) return;

        Timestamp timestamp = lastTimestamp.get();
        persist();
        attributesManager.clear(timestamp);
    }
View Full Code Here

                @Override
                public void setValue(org.tango.server.attribute.AttributeValue value) throws DevFailed {
                    this.value.set(value);
                    //fix NPE by adding "/" in the beginning. See AttributeName#getFullName
                    engine.writeAttributeValue("/" + wrapped.getName(), this.value.get().getValue(), new Timestamp(value.getTime()));
                }

                @Override
                public StateMachineBehavior getStateMachine() throws DevFailed {
                    return new StateMachineBehavior();
View Full Code Here

    @Override
    @Attribute
    public String[] getUpdates() throws Exception {
        RequestContext ctx = getContext();
        final Timestamp oldTimestamp = ctx.lastTimestamp;
        final Timestamp timestamp = Timestamp.now();

        RequestContext updated = new RequestContext(ctx.useAliases, ctx.encode, ctx.outputType, timestamp, ctx.attributesGroup);
        setContext(updated);

        Multimap<AttributeName, AttributeValue<?>> attributes = engine.getAllAttributeValues(oldTimestamp, ctx.attributesGroup);
View Full Code Here

    @Override
    @Command
    public String[] getDataRange(long[] fromTo) throws Exception {
        Preconditions.checkArgument(fromTo.length == 2, "Two elements are expected here: 0 - from timestamp; 1 - to timestamp");
        Preconditions.checkArgument(Longs.compare(fromTo[0], fromTo[1]) < 0, "'from' should be less than 'to'!");
        Timestamp from = new Timestamp(fromTo[0]);
        Timestamp to = new Timestamp(fromTo[1]);

        RequestContext ctx = getContext();

        Multimap<AttributeName, AttributeValue<?>> values = engine.getValuesRange(from, to, ctx.attributesGroup);
View Full Code Here

TOP

Related Classes of wpn.hdri.ss.data.Timestamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.