Search in sources :

Example 1 with LogLevel

use of com.xrtb.commands.LogLevel in project XRTB by benmfaul.

the class WebCampaign method doExecute.

/**
	 * Used to stop, start, nobbideason and change log level of a bidder
	 * instance.
	 * 
	 * @param m
	 *            Map. The command parameters.
	 * @return Sting. The JSON encoded return of the command.
	 * @throws Exception
	 *             on cache/aerospike or JSON errors.
	 */
public String doExecute(Map m) throws Exception {
    String action = (String) m.get("action");
    String who = (String) m.get("who");
    String username = (String) m.get("username");
    switch(action) {
        case "start":
            StartBidder start = new StartBidder();
            start.from = username;
            start.to = who;
            Controller.getInstance().startBidder(start);
            break;
        case "stop":
            StopBidder stop = new StopBidder();
            stop.from = username;
            stop.to = who;
            Controller.getInstance().stopBidder(stop);
            break;
        case "loglevel":
            LogLevel level = new LogLevel();
            level.from = username;
            level.to = who;
            String valu = (String) m.get("level");
            level.target = valu;
            Controller.getInstance().setLogLevel(level);
            break;
        case "nobidreason":
            NobidReason nbr = new NobidReason();
            nbr.from = username;
            nbr.to = who;
            valu = (String) m.get("level");
            nbr.target = valu;
            Controller.getInstance().setNoBidReason(nbr);
            break;
        case "reload":
            break;
        default:
            break;
    }
    Map x = new HashMap();
    x.put("message", "Command sent");
    return getString(x);
}
Also used : StopBidder(com.xrtb.commands.StopBidder) HashMap(java.util.HashMap) StartBidder(com.xrtb.commands.StartBidder) HashMap(java.util.HashMap) Map(java.util.Map) LogLevel(com.xrtb.commands.LogLevel) NobidReason(com.xrtb.commands.NobidReason)

Example 2 with LogLevel

use of com.xrtb.commands.LogLevel in project XRTB by benmfaul.

the class TestZZZRedis method testSetLogLevel.

/**
	 * Test the echo/status message
	 * 
	 * @throws Exception
	 *             if the Controller is not complete.
	 */
@Test
public void testSetLogLevel() throws Exception {
    LogLevel e = new LogLevel("*", "-3");
    e.id = "SETLOG-ID";
    rcv = null;
    latch = new CountDownLatch(1);
    commands.add(e);
    latch.await(5, TimeUnit.SECONDS);
    Echo echo = (Echo) rcv;
    // System.out.println(echo.toString());
    assertEquals(echo.loglevel, -3);
}
Also used : Echo(com.xrtb.commands.Echo) CountDownLatch(java.util.concurrent.CountDownLatch) LogLevel(com.xrtb.commands.LogLevel) Test(org.junit.Test)

Aggregations

LogLevel (com.xrtb.commands.LogLevel)2 Echo (com.xrtb.commands.Echo)1 NobidReason (com.xrtb.commands.NobidReason)1 StartBidder (com.xrtb.commands.StartBidder)1 StopBidder (com.xrtb.commands.StopBidder)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Test (org.junit.Test)1