Package org.apache.stratos.throttling.manager.scheduling

Examples of org.apache.stratos.throttling.manager.scheduling.ThrottlingJob


        Resource r1 = registry.newResource();
        r1.setContent("12345678");   // 8 byte is ok
        registry.put("/bang", r1);

        new ThrottlingJob().executeTask(task);

        try {
            putEmptyResource();
            assertTrue(true);
        } catch (Exception e) {
            e.printStackTrace();
            assertTrue(false);
        }

        r1.setContent("123456789");   // 9 byte is not ok
        registry.put("/bang", r1);

        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
            assertTrue(true);
            assertEquals("Your data is big. Bigger than 8", e.getMessage());
        }

        registry.delete("/bang");
        new ThrottlingJob().executeTask(task);

        r1.setContent("1234567891011");   // > 10 byte is not ok
        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(true);
        } catch (Exception e) {
            assertTrue(false);
            e.printStackTrace();
        }
        registry.delete("/bang");
        new ThrottlingJob().executeTask(task);

        r1.setContent("1234567890123456");
        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
            assertTrue(true);
            assertEquals("the strange condition for test1 is met", e.getMessage());
        }
        registry.delete("/bang");
        new ThrottlingJob().executeTask(task);

        r1.setContent("12345678901234567");
        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
            assertTrue(true);
View Full Code Here


        Task task = getThrottlingTask(configFile, ruleFile);

        Resource r1 = registry.newResource();
        r1.setContent("12345678");   // 8 byte in
        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(true);
        } catch (Exception e) {
            assertTrue(false);
            e.printStackTrace();
        }

        r1.setContent("12345678");   // another 8 byte in
        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
            assertTrue(true);
            assertEquals("Your incoming bw is big. Bigger than 12. your value: 16", e.getMessage());
        }

        // setting another 8 bytes, this should give the early message rather than a new one

        new ThrottlingJob().executeTask(task);
        r1.setContent("12345678");   // another 8 byte in
        try {
            registry.put("/bang", r1);
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
View Full Code Here

        Resource r1 = registry.newResource();
        r1.setContent("12345678");   // 8 byte in

        registry.put("/bang", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(true);
        } catch (Exception e) {
            assertTrue(false);
            e.printStackTrace();
        }

        r1.setContent("12345678");   // another 8 byte in
        registry.put("/bang2", r1);
        new ThrottlingJob().executeTask(task);
        try {
            putEmptyResource();
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
            assertTrue(true);
            assertEquals("Your resource volume is big. Bigger than 12. your value: 16", e.getMessage());
        }

        // setting another 8 bytes, this should give the early message rather than a new one
        // if the pre handlers are doing the job. because the value 16 will be increased only
        // it goes through the pre dataProviderConfigs

        new ThrottlingJob().executeTask(task);
        r1.setContent("12345678");   // another 8 byte in
        try {
            registry.put("/bang3", r1);
            assertTrue(false); // we expect the exception
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.stratos.throttling.manager.scheduling.ThrottlingJob

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.