@Test public void testGetPathInfo () throws Exception { AzurePathInfo info; info = AzureUtils.getPathInfo ("wasb: Assert.assertEquals ("wasb", info.protocol); Assert.assertNull (info.account); Assert.assertNull (info.container); Assert.assertEquals ("examples/abc.json", info.file); info = AzureUtils.getPathInfo ("wasbs: Assert.assertEquals ("wasbs", info.protocol); Assert.assertNull (info.account); Assert.assertNull (info.container); Assert.assertEquals ("examples/abc.json", info.file); info = AzureUtils.getPathInfo ("wasbs: Assert.assertEquals ("wasbs", info.protocol); Assert.assertEquals ("b", info.account); Assert.assertEquals ("a", info.container); Assert.assertEquals ("examples.json", info.file); info = AzureUtils.getPathInfo ("wasbs: Assert.assertEquals ("wasbs", info.protocol); Assert.assertEquals ("b", info.account); Assert.assertEquals ("a", info.container); Assert.assertEquals ("examples.json", info.file); info = AzureUtils.getPathInfo ("wasbs: Assert.assertEquals ("wasbs", info.protocol); Assert.assertEquals ("b", info.account); Assert.assertEquals ("a", info.container); Assert.assertEquals (null, info.file); }
public static AzurePathInfo getPathInfo (String path) { Matcher m = s_pattern.matcher (path); if (!m.find ()) throw new IllegalArgumentException ("Invalid Azure path: " + path); AzurePathInfo info = new AzurePathInfo (); info.protocol = m.group (1); info.container = m.group (2); if (info.container != null) { info.container = info.container.substring (0, info.container.length () - 1); } info.account = m.group (3); if (info.account != null) { info.account = info.account.toLowerCase (); if (info.account.endsWith (BLOB_SERVER)) { info.account = info.account.substring (0, info.account.length () - BLOB_SERVER.length ()); } } info.file = m.group (4); if (info.file != null) { info.file = info.file.substring (1); } return info; }
AzureUtils { public static AzurePathInfo getPathInfo (String path) { Matcher m = s_pattern.matcher (path); if (!m.find ()) throw new IllegalArgumentException ("Invalid Azure path: " + path); AzurePathInfo info = new AzurePathInfo (); info.protocol = m.group (1); info.container = m.group (2); if (info.container != null) { info.container = info.container.substring (0, info.container.length () - 1); } info.account = m.group (3); if (info.account != null) { info.account = info.account.toLowerCase (); if (info.account.endsWith (BLOB_SERVER)) { info.account = info.account.substring (0, info.account.length () - BLOB_SERVER.length ()); } } info.file = m.group (4); if (info.file != null) { info.file = info.file.substring (1); } return info; } }
AzureUtils { public static AzurePathInfo getPathInfo (String path) { Matcher m = s_pattern.matcher (path); if (!m.find ()) throw new IllegalArgumentException ("Invalid Azure path: " + path); AzurePathInfo info = new AzurePathInfo (); info.protocol = m.group (1); info.container = m.group (2); if (info.container != null) { info.container = info.container.substring (0, info.container.length () - 1); } info.account = m.group (3); if (info.account != null) { info.account = info.account.toLowerCase (); if (info.account.endsWith (BLOB_SERVER)) { info.account = info.account.substring (0, info.account.length () - BLOB_SERVER.length ()); } } info.file = m.group (4); if (info.file != null) { info.file = info.file.substring (1); } return info; }  }
AzureUtils { public static AzurePathInfo getPathInfo (String path) { Matcher m = s_pattern.matcher (path); if (!m.find ()) throw new IllegalArgumentException ("Invalid Azure path: " + path); AzurePathInfo info = new AzurePathInfo (); info.protocol = m.group (1); info.container = m.group (2); if (info.container != null) { info.container = info.container.substring (0, info.container.length () - 1); } info.account = m.group (3); if (info.account != null) { info.account = info.account.toLowerCase (); if (info.account.endsWith (BLOB_SERVER)) { info.account = info.account.substring (0, info.account.length () - BLOB_SERVER.length ()); } } info.file = m.group (4); if (info.file != null) { info.file = info.file.substring (1); } return info; }  static void setAccount(String account, JaqyInterpreter interpreter); static void setContainer(String container, JaqyInterpreter interpreter); static void setKey(String key, JaqyInterpreter interpreter); static void setEndPoint(String endPoint, JaqyInterpreter interpreter); static CloudBlobClient getBlobClient(JaqyInterpreter interpreter, String account); static AzurePathInfo getPathInfo(String path); static CloudBlobContainer getContainer(String account, String container, JaqyInterpreter interpreter); static void createContainer(String container, JaqyInterpreter interpreter); static void deleteContainer(String container, JaqyInterpreter interpreter); }
AzureUtils { public static AzurePathInfo getPathInfo (String path) { Matcher m = s_pattern.matcher (path); if (!m.find ()) throw new IllegalArgumentException ("Invalid Azure path: " + path); AzurePathInfo info = new AzurePathInfo (); info.protocol = m.group (1); info.container = m.group (2); if (info.container != null) { info.container = info.container.substring (0, info.container.length () - 1); } info.account = m.group (3); if (info.account != null) { info.account = info.account.toLowerCase (); if (info.account.endsWith (BLOB_SERVER)) { info.account = info.account.substring (0, info.account.length () - BLOB_SERVER.length ()); } } info.file = m.group (4); if (info.file != null) { info.file = info.file.substring (1); } return info; }  static void setAccount(String account, JaqyInterpreter interpreter); static void setContainer(String container, JaqyInterpreter interpreter); static void setKey(String key, JaqyInterpreter interpreter); static void setEndPoint(String endPoint, JaqyInterpreter interpreter); static CloudBlobClient getBlobClient(JaqyInterpreter interpreter, String account); static AzurePathInfo getPathInfo(String path); static CloudBlobContainer getContainer(String account, String container, JaqyInterpreter interpreter); static void createContainer(String container, JaqyInterpreter interpreter); static void deleteContainer(String container, JaqyInterpreter interpreter); final static String WASB_CLIENT_VAR; final static String WASB_ACCOUNT_VAR; final static String WASB_CONTAINER_VAR; final static String WASB_KEY_VAR; final static String WASB_ENDPOINT_VAR; }