use of com.xrtb.commands.DeleteCampaign in project XRTB by benmfaul.
the class WebCampaign method stopCampaign.
/**
* Delete a campaign
*
* @param cmd
* Map. The delete command map from the web user.
* @return String. The list of campaigns running.
*/
public String stopCampaign(Map cmd) throws Exception {
String name = (String) cmd.get("username");
String adId = (String) cmd.get("id");
Map response = new HashMap();
try {
Controller.getInstance().deleteCampaign(name, adId);
response.put("error", false);
DeleteCampaign command = new DeleteCampaign("", name, adId);
command.to = "*";
command.from = Configuration.getInstance().instanceName;
Controller.getInstance().sendLog(3, "WebAccess-New-Campaign", "Campaign stopped: " + adId);
} catch (Exception error) {
error.printStackTrace();
response.put("message", "failed: " + error.toString());
response.put("error", true);
}
response.put("running", Configuration.getInstance().getLoadedCampaignNames());
return getString(response);
}
use of com.xrtb.commands.DeleteCampaign in project XRTB by benmfaul.
the class Commands method stopCampaign.
/**
* Stop a campaign by removing from bidders memory
*/
public void stopCampaign() {
System.out.print("Which bidder to stop campaign:");
String to = scan.nextLine();
System.out.print("Which campaign owner: ");
String owner = scan.nextLine();
System.out.print("Which campaign: ");
String cname = scan.nextLine();
DeleteCampaign cmd = new DeleteCampaign(to, owner, cname);
cmd.from = uuid;
commands.add(cmd);
}
use of com.xrtb.commands.DeleteCampaign in project XRTB by benmfaul.
the class TestZZZRedis method deleteUnknownCampaign.
/**
* Test deleting a campaign
*/
@Test
public void deleteUnknownCampaign() throws Exception {
DeleteCampaign e = new DeleteCampaign("", "ben", "id123");
e.id = "DELETECAMP-ID";
rcv = null;
latch = new CountDownLatch(1);
commands.add(e);
latch.await(5, TimeUnit.SECONDS);
}
Aggregations