Back to index

lightning-sunbird  0.9+nobinonly
TestQI.java
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is Java XPCOM Bindings.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * IBM Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 2004
00019  * IBM Corporation. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *   Javier Pedemonte (jhpedemonte@gmail.com)
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 import org.mozilla.xpcom.*;
00039 import java.io.*;
00040 import java.util.*;
00041 
00042 
00051 public class TestQI {
00052 
00053   public static void main(String [] args) throws Exception {
00054     System.loadLibrary("javaxpcom");
00055 
00056     String mozillaPath = System.getProperty("MOZILLA_FIVE_HOME");
00057     if (mozillaPath == null) {
00058       throw new RuntimeException("MOZILLA_FIVE_HOME system property not set.");
00059     }
00060 
00061     File localFile = new File(mozillaPath);
00062     XPCOM.initXPCOM(localFile, null);
00063 
00064     FooFile foo = new FooFile();
00065 
00066     nsIFileURL fileURL = (nsIFileURL) foo.queryInterface(nsIFileURL.NS_IFILEURL_IID);
00067     if (fileURL == null) {
00068       throw new RuntimeException("Failed to QI to nsIFileURL.");
00069     }
00070 
00071     nsIURL url = (nsIURL) foo.queryInterface(nsIURL.NS_IURL_IID);
00072     if (url == null) {
00073       throw new RuntimeException("Failed to QI to nsIURL.");
00074     }
00075 
00076     nsIURI uri = (nsIURI) foo.queryInterface(nsIURI.NS_IURI_IID);
00077     if (uri == null) {
00078       throw new RuntimeException("Failed to QI to nsIURI.");
00079     }
00080 
00081     nsISupports supp = (nsISupports) foo.queryInterface(nsISupports.NS_ISUPPORTS_IID);
00082     if (supp == null) {
00083       throw new RuntimeException("Failed to QI to nsISupports.");
00084     }
00085 
00086     XPCOM.shutdownXPCOM(null);
00087 
00088     System.out.println("Test Passed.");
00089   }
00090 }
00091 
00092 
00106 class FooFile implements nsIFileURL {
00107 
00108   public nsISupports queryInterface(String aIID) {
00109       return XPCOM.queryInterface(this, aIID);
00110   }
00111 
00112        public nsIFile getFile() {
00113               return null;
00114        }
00115 
00116        public void setFile(nsIFile aFile) {
00117        }
00118 
00119        public String getFilePath() {
00120               return null;
00121        }
00122 
00123        public void setFilePath(String aFilePath) {
00124        }
00125 
00126        public String getParam() {
00127               return null;
00128        }
00129 
00130        public void setParam(String aParam) {
00131        }
00132 
00133        public String getQuery() {
00134               return null;
00135        }
00136 
00137        public void setQuery(String aQuery) {
00138        }
00139 
00140        public String getRef() {
00141               return null;
00142        }
00143 
00144        public void setRef(String aRef) {
00145        }
00146 
00147        public String getDirectory() {
00148               return null;
00149        }
00150 
00151        public void setDirectory(String aDirectory) {
00152        }
00153 
00154        public String getFileName() {
00155               return null;
00156        }
00157 
00158        public void setFileName(String aFileName) {
00159        }
00160 
00161        public String getFileBaseName() {
00162               return null;
00163        }
00164 
00165        public void setFileBaseName(String aFileBaseName) {
00166        }
00167 
00168        public String getFileExtension() {
00169               return null;
00170        }
00171 
00172        public void setFileExtension(String aFileExtension) {
00173        }
00174 
00175        public String getCommonBaseSpec(nsIURI aURIToCompare) {
00176               return null;
00177        }
00178 
00179        public String getRelativeSpec(nsIURI aURIToCompare) {
00180               return null;
00181        }
00182 
00183        public String getSpec() {
00184               return null;
00185        }
00186 
00187        public void setSpec(String aSpec) {
00188        }
00189 
00190        public String getPrePath() {
00191               return null;
00192        }
00193 
00194        public String getScheme() {
00195               return null;
00196        }
00197 
00198        public void setScheme(String aScheme) {
00199        }
00200 
00201        public String getUserPass() {
00202               return null;
00203        }
00204 
00205        public void setUserPass(String aUserPass) {
00206        }
00207 
00208        public String getUsername() {
00209               return null;
00210        }
00211 
00212        public void setUsername(String aUsername) {
00213        }
00214 
00215        public String getPassword() {
00216               return null;
00217        }
00218 
00219        public void setPassword(String aPassword) {
00220        }
00221 
00222        public String getHostPort() {
00223               return null;
00224        }
00225 
00226        public void setHostPort(String aHostPort) {
00227        }
00228 
00229        public String getHost() {
00230               return null;
00231        }
00232 
00233        public void setHost(String aHost) {
00234        }
00235 
00236        public int getPort() {
00237               return 0;
00238        }
00239 
00240        public void setPort(int aPort) {
00241        }
00242 
00243        public String getPath() {
00244               return null;
00245        }
00246 
00247        public void setPath(String aPath) {
00248        }
00249 
00250        public boolean equals(nsIURI other) {
00251               return false;
00252        }
00253 
00254        public boolean schemeIs(String scheme) {
00255               return false;
00256        }
00257 
00258        public nsIURI clone_() {
00259               return null;
00260        }
00261 
00262        public String resolve(String relativePath) {
00263               return null;
00264        }
00265 
00266        public String getAsciiSpec() {
00267               return null;
00268        }
00269 
00270        public String getAsciiHost() {
00271               return null;
00272        }
00273 
00274        public String getOriginCharset() {
00275               return null;
00276        }
00277 }
00278