public String mediaGetStreamUrl(
     String url,
     String id,
     String asset_name,
     int seclevel,
     String asnum,
     String ip,
     String useragent,
     String[] countries,
     String[] referers,
     int expires,
     String extension,
     Boolean download)
     throws DCException {
   if (extension.equals("")) {
     String[] parts = asset_name.split("\\_");
     extension = (!parts[0].equals(asset_name)) ? parts[0] : extension;
   }
   if (asset_name.length() >= 15 && asset_name.substring(0, 15).equals("jpeg_thumbnail_")) {
     return CloudKey.STATIC_URL + this.user_id + "/" + id + "/" + asset_name + "." + extension;
   } else {
     String _url =
         this.cdn_url
             + "/route/"
             + this.user_id
             + "/"
             + id
             + "/"
             + asset_name
             + ((!extension.equals("")) ? "." + extension : "");
     return Helpers.sign_url(
             _url, this.api_key, seclevel, asnum, ip, useragent, countries, referers, expires)
         + (download ? "&throttle=0&helper=0&cache=0" : "");
   }
 }
 public String mediaGetEmbedUrl(
     String url,
     String id,
     int seclevel,
     String asnum,
     String ip,
     String useragent,
     String[] countries,
     String[] referers,
     int expires)
     throws DCException {
   String _url = url + "/embed/" + this.user_id + "/" + id;
   return Helpers.sign_url(
       _url, this.api_key, seclevel, asnum, ip, useragent, countries, referers, expires);
 }
  public boolean runTest() {
    ExceptionHandling.classNameToErrorKeyToThrow = new HashMap<String, String>();
    testsRun = new LinkedList<String>();

    Set<String> expectedTestsRun = new HashSet<String>();
    // No restrictionsontests so they all run.
    expectedTestsRun.add("a44.a.test.UnitTester");
    expectedTestsRun.add("a44.b.test.UnitTester");
    expectedTestsRun.add("a44.c.test.UnitTester");
    expectedTestsRun.add("a44.a.functiontest.FT");
    expectedTestsRun.add("a44.b.functiontest.FT");
    expectedTestsRun.add("a44.c.functiontest.FT");
    expectedTestsRun.add("a44.a.loadtest.LT");
    expectedTestsRun.add("a44.b.loadtest.LT");
    expectedTestsRun.add("a44.c.loadtest.LT");
    GrandTestAuto gta = Helpers.setupForZip(new File(Grandtestauto.test44_zip), true, true, true);
    assert gta.runAllTests(); // Sanity check.
    assert testsRun.size() == 9;
    assert testsRun.containsAll(expectedTestsRun);

    // Initial package set.
    expectedTestsRun = new HashSet<String>();
    testsRun = new LinkedList<String>();
    expectedTestsRun.add("a44.b.test.UnitTester");
    expectedTestsRun.add("a44.c.test.UnitTester");
    expectedTestsRun.add("a44.b.functiontest.FT");
    expectedTestsRun.add("a44.c.functiontest.FT");
    expectedTestsRun.add("a44.b.loadtest.LT");
    expectedTestsRun.add("a44.c.loadtest.LT");
    gta =
        Helpers.setupForZip(
            new File(Grandtestauto.test44_zip),
            true,
            true,
            true,
            "a44.b",
            null,
            null,
            false,
            false,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null);
    assert gta.runAllTests(); // Sanity check.
    assert testsRun.size() == 6;
    assert testsRun.containsAll(expectedTestsRun);

    // Final package set.
    expectedTestsRun = new HashSet<String>();
    testsRun = new LinkedList<String>();
    expectedTestsRun.add("a44.a.test.UnitTester");
    expectedTestsRun.add("a44.b.test.UnitTester");
    expectedTestsRun.add("a44.a.functiontest.FT");
    expectedTestsRun.add("a44.b.functiontest.FT");
    expectedTestsRun.add("a44.a.loadtest.LT");
    expectedTestsRun.add("a44.b.loadtest.LT");
    gta =
        Helpers.setupForZip(
            new File(Grandtestauto.test44_zip),
            true,
            true,
            true,
            null,
            "a44.b.loadtest",
            null,
            false,
            false,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null);
    assert gta.runAllTests(); // Sanity check.
    assert testsRun.size() == 6;
    assert testsRun.containsAll(expectedTestsRun);

    // Initial and final package set.
    expectedTestsRun = new HashSet<String>();
    testsRun = new LinkedList<String>();
    expectedTestsRun.add("a44.b.test.UnitTester");
    expectedTestsRun.add("a44.b.functiontest.FT");
    expectedTestsRun.add("a44.b.loadtest.LT");
    gta =
        Helpers.setupForZip(
            new File(Grandtestauto.test44_zip),
            true,
            true,
            true,
            "a44.b",
            "a44.b.loadtest",
            null,
            false,
            false,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null);
    assert gta.runAllTests(); // Sanity check.
    assert testsRun.size() == 3;
    assert testsRun.containsAll(expectedTestsRun);

    // Initial, final and single package set.
    expectedTestsRun = new HashSet<String>();
    testsRun = new LinkedList<String>();
    expectedTestsRun.add("a44.c.functiontest.FT");
    gta =
        Helpers.setupForZip(
            new File(Grandtestauto.test44_zip),
            true,
            true,
            true,
            "a44.b",
            "a44.b.loadtest",
            "a44.c.functiontest",
            false,
            false,
            null,
            null,
            null,
            null,
            null,
            null,
            null,
            null);
    assert gta.runAllTests(); // Sanity check.
    assert testsRun.size() == 1;
    assert testsRun.containsAll(expectedTestsRun);
    return true;
  }