test_class.file: cosmic-common/src/test/java/com/cloud/utils/UriUtilsTest.java
test_class.identifier: UriUtilsTest
test_case.body: @Test
      public void getUpdateUri() {
          // no password param, no request for encryption
          Assert.assertEquals("http://localhost/foo/bar?param=true", UriUtils
                  .getUpdateUri("http://localhost/foo/bar?param=true", false));
          // there is password param but still no request for encryption, should
          // be unchanged
          Assert.assertEquals("http://localhost/foo/bar?password=1234", UriUtils
                  .getUpdateUri("http://localhost/foo/bar?password=1234", false));
          // if there is password param and encryption is requested then it may or
          // may not be changed depending on how the EncrytionUtils is setup, but
          // at least it needs to start with the same url
          Assert.assertTrue(UriUtils.getUpdateUri(
                  "http://localhost/foo/bar?password=1234", true).startsWith(
                  "http://localhost/foo/bar"));
  
          //just to see if it is still ok with multiple parameters
          Assert.assertEquals("http://localhost/foo/bar?param1=true&param2=12345", UriUtils
                  .getUpdateUri("http://localhost/foo/bar?param1=true&param2=12345", false));
  
          //XXX: Interesting cases not covered:
          // * port is ignored and left out from the return value
      }
test_case.class_method_signature: UriUtilsTest.getUpdateUri()
test_case.full_signature: @Test public void getUpdateUri()
test_case.identifier: getUpdateUri
test_case.invocations: assertEquals getUpdateUri assertEquals getUpdateUri assertTrue startsWith getUpdateUri assertEquals getUpdateUri
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getUpdateUri()
focal_class.declarator: s_logger = LoggerFactory.getLogger(UriUtils.class.getName())
focal_class.modifier: public static final
focal_class.original_string: public static final Logger s_logger = LoggerFactory.getLogger(UriUtils.class.getName());
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.file: cosmic-common/src/main/java/com/cloud/utils/UriUtils.java
focal_class.identifier: UriUtils
focal_class.class_method_signature: UriUtils.formNfsUri(final String host, final String path)
focal_class.full_signature: public static String formNfsUri(final String host, final String path)
focal_class.identifier: formNfsUri
focal_class.modifiers: public static
focal_class.parameters: (final String host, final String path)
focal_class.return: String
focal_class.signature: String formNfsUri(final String host, final String path)
focal_class.class_method_signature: UriUtils.formIscsiUri(final String host, final String iqn, final Integer lun)
focal_class.full_signature: public static String formIscsiUri(final String host, final String iqn, final Integer lun)
focal_class.identifier: formIscsiUri
focal_class.modifiers: public static
focal_class.parameters: (final String host, final String iqn, final Integer lun)
focal_class.return: String
focal_class.signature: String formIscsiUri(final String host, final String iqn, final Integer lun)
focal_class.class_method_signature: UriUtils.formFileUri(final String path)
focal_class.full_signature: public static String formFileUri(final String path)
focal_class.identifier: formFileUri
focal_class.modifiers: public static
focal_class.parameters: (final String path)
focal_class.return: String
focal_class.signature: String formFileUri(final String path)
focal_class.class_method_signature: UriUtils.encodeURIComponent(final String url)
focal_class.full_signature: public static String encodeURIComponent(final String url)
focal_class.identifier: encodeURIComponent
focal_class.modifiers: public static
focal_class.parameters: (final String url)
focal_class.return: String
focal_class.signature: String encodeURIComponent(final String url)
focal_class.class_method_signature: UriUtils.getCifsUriParametersProblems(final URI uri)
focal_class.full_signature: public static String getCifsUriParametersProblems(final URI uri)
focal_class.identifier: getCifsUriParametersProblems
focal_class.modifiers: public static
focal_class.parameters: (final URI uri)
focal_class.return: String
focal_class.signature: String getCifsUriParametersProblems(final URI uri)
focal_class.class_method_signature: UriUtils.hostAndPathPresent(final URI uri)
focal_class.full_signature: public static boolean hostAndPathPresent(final URI uri)
focal_class.identifier: hostAndPathPresent
focal_class.modifiers: public static
focal_class.parameters: (final URI uri)
focal_class.return: boolean
focal_class.signature: boolean hostAndPathPresent(final URI uri)
focal_class.class_method_signature: UriUtils.cifsCredentialsPresent(final URI uri)
focal_class.full_signature: public static boolean cifsCredentialsPresent(final URI uri)
focal_class.identifier: cifsCredentialsPresent
focal_class.modifiers: public static
focal_class.parameters: (final URI uri)
focal_class.return: boolean
focal_class.signature: boolean cifsCredentialsPresent(final URI uri)
focal_class.class_method_signature: UriUtils.getUpdateUri(final String url, final boolean encrypt)
focal_class.full_signature: public static String getUpdateUri(final String url, final boolean encrypt)
focal_class.identifier: getUpdateUri
focal_class.modifiers: public static
focal_class.parameters: (final String url, final boolean encrypt)
focal_class.return: String
focal_class.signature: String getUpdateUri(final String url, final boolean encrypt)
focal_class.class_method_signature: UriUtils.getUserDetails(final String query)
focal_class.full_signature: private static List<NameValuePair> getUserDetails(final String query)
focal_class.identifier: getUserDetails
focal_class.modifiers: private static
focal_class.parameters: (final String query)
focal_class.return: List<NameValuePair>
focal_class.signature: List<NameValuePair> getUserDetails(final String query)
focal_class.class_method_signature: UriUtils.getRemoteSize(final String url)
focal_class.full_signature: public static Long getRemoteSize(final String url)
focal_class.identifier: getRemoteSize
focal_class.modifiers: public static
focal_class.parameters: (final String url)
focal_class.return: Long
focal_class.signature: Long getRemoteSize(final String url)
focal_class.class_method_signature: UriUtils.checkUrlExistence(final String url)
focal_class.full_signature: public static void checkUrlExistence(final String url)
focal_class.identifier: checkUrlExistence
focal_class.modifiers: public static
focal_class.parameters: (final String url)
focal_class.return: void
focal_class.signature: void checkUrlExistence(final String url)
focal_class.class_method_signature: UriUtils.getInputStreamFromUrl(final String url, final String user, final String password)
focal_class.full_signature: public static InputStream getInputStreamFromUrl(final String url, final String user, final String password)
focal_class.identifier: getInputStreamFromUrl
focal_class.modifiers: public static
focal_class.parameters: (final String url, final String user, final String password)
focal_class.return: InputStream
focal_class.signature: InputStream getInputStreamFromUrl(final String url, final String user, final String password)
focal_class.class_method_signature: UriUtils.validateUrl(final String url)
focal_class.full_signature: public static Pair<String, Integer> validateUrl(final String url)
focal_class.identifier: validateUrl
focal_class.modifiers: public static
focal_class.parameters: (final String url)
focal_class.return: Pair<String, Integer>
focal_class.signature: Pair<String, Integer> validateUrl(final String url)
focal_class.class_method_signature: UriUtils.validateUrl(final String format, final String url)
focal_class.full_signature: public static Pair<String, Integer> validateUrl(final String format, final String url)
focal_class.identifier: validateUrl
focal_class.modifiers: public static
focal_class.parameters: (final String format, final String url)
focal_class.return: Pair<String, Integer>
focal_class.signature: Pair<String, Integer> validateUrl(final String format, final String url)
focal_class.class_method_signature: UriUtils.checkFormat(final String format, final String uripath)
focal_class.full_signature: private static void checkFormat(final String format, final String uripath)
focal_class.identifier: checkFormat
focal_class.modifiers: private static
focal_class.parameters: (final String format, final String uripath)
focal_class.return: void
focal_class.signature: void checkFormat(final String format, final String uripath)
focal_method.body: public static String getUpdateUri(final String url, final boolean encrypt) {
          String updatedPath = null;
          try {
              final String query = URIUtil.getQuery(url);
              final URIBuilder builder = new URIBuilder(url);
              builder.removeQuery();
  
              final StringBuilder updatedQuery = new StringBuilder();
              final List<NameValuePair> queryParams = getUserDetails(query);
              final ListIterator<NameValuePair> iterator = queryParams.listIterator();
              while (iterator.hasNext()) {
                  final NameValuePair param = iterator.next();
                  String value = null;
                  if ("password".equalsIgnoreCase(param.getName()) &&
                          param.getValue() != null) {
                      value = encrypt ? DBEncryptionUtil.encrypt(param.getValue()) : DBEncryptionUtil.decrypt(param.getValue());
                  } else {
                      value = param.getValue();
                  }
  
                  if (updatedQuery.length() == 0) {
                      updatedQuery.append(param.getName()).append('=')
                                  .append(value);
                  } else {
                      updatedQuery.append('&').append(param.getName())
                                  .append('=').append(value);
                  }
              }
  
              String schemeAndHost = "";
              final URI newUri = builder.build();
              if (newUri.getScheme() != null) {
                  schemeAndHost = newUri.getScheme() + "://" + newUri.getHost();
              }
  
              updatedPath = schemeAndHost + newUri.getPath() + "?" + updatedQuery;
          } catch (final URISyntaxException e) {
              throw new CloudRuntimeException("Couldn't generate an updated uri. " + e.getMessage());
          }
  
          return updatedPath;
      }
focal_method.class_method_signature: UriUtils.getUpdateUri(final String url, final boolean encrypt)
focal_method.full_signature: public static String getUpdateUri(final String url, final boolean encrypt)
focal_method.identifier: getUpdateUri
focal_method.invocations: getQuery removeQuery getUserDetails listIterator hasNext next equalsIgnoreCase getName getValue encrypt getValue decrypt getValue getValue length append append append getName append append append append getName build getScheme getScheme getHost getPath getMessage
focal_method.modifiers: public static
focal_method.parameters: (final String url, final boolean encrypt)
focal_method.return: String
focal_method.signature: String getUpdateUri(final String url, final boolean encrypt)