Package com.walmartlabs.mupd8.application

Examples of com.walmartlabs.mupd8.application.Mupd8DataPair


  @SuppressWarnings("unchecked")
    public void testConfigDirLoad() throws Exception {
        String dir =
            this.getClass().getClassLoader().getResource( "testapp").getPath();
        Config config = new Config( new File( dir));
        String[] paths = { "mupd8", "application", "TestApp", "performers", "K1Updater", "class"};
        String k1Updater = ( String) config.getScopedValue( paths);
        assertEquals("check performer class value", "com.walmartlabs.mupd8.examples.KnUpdaterJson", k1Updater);
        String[] cassPath = { "mupd8", "slate_store", "keyspace"};
        assertEquals("check slate_store" , "Mupd8", ( String) config.getScopedValue( cassPath));

        JSONObject performerConfig = config.workerJSONs.get("K1Updater");
        assertEquals("workerJSONs defined in directory configuration", k1Updater, (String) performerConfig.get("class"));

        String sys =
            this.getClass().getClassLoader().getResource( "testapp/sys_old").getPath();
        String app =
            this.getClass().getClassLoader().getResource( "testapp/app_old").getPath();

        Config newConfig = new Config(sys, app);
        String[] clPath = { "mupd8", "application" };
        java.util.HashMap<String, Object> testApp = ( java.util.HashMap<String, Object>) newConfig.getScopedValue( clPath);
        String firstKey = ( String) testApp.keySet().toArray()[0];
        assertEquals("contains TestApp", "TestApp", firstKey);

        performerConfig = newConfig.workerJSONs.get("K1Updater");
        assertEquals("workerJSONs defined in sys/app configuration", "com.walmartlabs.mupd8.examples.KnUpdater", (String) performerConfig.get("class"));
View Full Code Here


        assertTrue("HasNext should not consume data",kafkaSource.hasNext());
    }

    public void testNext() {
        assertTrue("HasNext should return true when data", kafkaSource.hasNext());
        Mupd8DataPair mupd8DataPair = kafkaSource.getNextDataPair();
        assertEquals("Next should return the correct message",val,mupd8DataPair._key.toString());
        produceNonJsonMessage();
        mupd8DataPair = kafkaSource.getNextDataPair();
        assertEquals("Next should return the next correct message",val, new String(mupd8DataPair._value));
        assertNull("Next should return the null val for missing key", mupd8DataPair._key);
View Full Code Here

    @Override
    public Mupd8DataPair getNextDataPair() {
         try {
            byte[] msg = consumerIterator.next().message();
            Mupd8DataPair ret = new Mupd8DataPair();
            ret._value = msg;
            ret._key = getValue(key,msg);
            return ret;
         } catch (Exception e) {
            LOG.error("Exception in getting next value from consumer stream", e);
View Full Code Here

TOP

Related Classes of com.walmartlabs.mupd8.application.Mupd8DataPair

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.