Example usage for java.net MalformedURLException getLocalizedMessage

List of usage examples for java.net MalformedURLException getLocalizedMessage

Introduction

In this page you can find the example usage for java.net MalformedURLException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:TimestreamsTests.java

/**
 * Tests calling /metadata with missing security parameters
 *///from   w  w w.  j  a va 2 s. c o m
@Test
public void testGetMetadataMissingSecurity() {
    try {
        URL url = new URL(BASEURL + "/metadata");
        getFailureTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /metadata with valid parameters
 *//*from   w  w  w  . j a  v a 2 s.  c  om*/
@Test
public void testGetMetadataLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/metadata", params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /measurement_containers with valid parameters for the URL
 * being tested against./*  w  w  w. j  av a2  s  .  c  om*/
 */
@Test
public void testGetMCLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/measurement_containers", params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /context with valid parameters for the URL being tested
 * against.// w  w w . j  av  a 2s . c  o m
 */
@Test
public void testGetContextLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/context", params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /context with valid parameters for the URL being tested
 * against.//  w ww  .ja v a  2 s . co m
 */
@Test
public void testGetTimestreamsLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/timestreams", params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /metadata/id with valid parameters for the URL being tested
 * against.//w w  w  .  java  2s  .  com
 * Note: id should be an existing measurement container table name 
 */
@Test
public void testGetMetadataContainerLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        String id = "wp_1_ts_temperature_1";
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/metadata/" + id, params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /measurement_container/[id] with valid parameters for the
 * URL being tested against. Note that id should be a valid measurement
 * container table name/*from w  w w.ja va2s.com*/
 */
@Test
public void testGetMCIdLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        String id = "wp_1_ts_Pressure_25";
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/measurement_container/" + id, params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /timestream/id/[id] with valid parameters for the URL being
 * tested against. Note that id should be a valid timestream id
 *///  ww w. ja  v  a 2 s .  co  m
@Test
public void testGetTimestreamsIdLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        String id = "1";
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/timestream/id/" + id, params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /timestream/name/[name] with valid parameters for the URL
 * being tested against. Note that id should be a valid mc table name
 *///  www. j  a v  a  2 s .  c  om
@Test
public void testGetTimestreamsNameLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        String id = "wp_1_ts_temperature_23";
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/timestream/name/" + id, params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}

From source file:TimestreamsTests.java

/**
 * Tests calling /timestream/head/[id] with valid parameters for the URL
 * being tested against. Note that id should be a valid head id
 *///from  w ww .  j a  va  2s.  co m
@Test
public void testGetTimestreamsHeadIdLegit() {
    try {
        long time = new Date().getTime();
        String now = Long.toString(time).substring(0, 10);
        String id = "1";
        List<String> params = new ArrayList<String>();
        params.add(PUBKEY);
        params.add(now);
        String urlStr = getSecurityString(BASEURL + "/timestream/head/" + id, params, now);
        URL url = new URL(urlStr);
        getTest(url);
    } catch (MalformedURLException e) {
        fail(e.getLocalizedMessage());
    }
}