001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.harmony.jndi.tests.javax.naming.spi.mock;
018:
019: import java.util.Hashtable;
020:
021: import javax.naming.Binding;
022: import javax.naming.Context;
023: import javax.naming.Name;
024: import javax.naming.NameClassPair;
025: import javax.naming.NameParser;
026: import javax.naming.NamingEnumeration;
027: import javax.naming.NamingException;
028: import javax.naming.directory.Attributes;
029: import javax.naming.directory.DirContext;
030: import javax.naming.directory.ModificationItem;
031: import javax.naming.directory.SearchControls;
032: import javax.naming.directory.SearchResult;
033:
034: /**
035: *
036: */
037: public class MockDirContext3 implements DirContext {
038:
039: private Hashtable<String, Object> prop;
040:
041: public MockDirContext3(Hashtable<String, Object> h) {
042: this .prop = h;
043: }
044:
045: /*
046: * (non-Javadoc)
047: *
048: * @see javax.naming.directory.DirContext#bind(javax.naming.Name,
049: * java.lang.Object, javax.naming.directory.Attributes)
050: */
051: public void bind(Name name, Object obj, Attributes attributes)
052: throws NamingException {
053: // Auto-generated method stub
054:
055: }
056:
057: /*
058: * (non-Javadoc)
059: *
060: * @see javax.naming.directory.DirContext#bind(java.lang.String,
061: * java.lang.Object, javax.naming.directory.Attributes)
062: */
063: public void bind(String s, Object obj, Attributes attributes)
064: throws NamingException {
065: // Auto-generated method stub
066:
067: }
068:
069: /*
070: * (non-Javadoc)
071: *
072: * @see javax.naming.directory.DirContext#createSubcontext(javax.naming.Name,
073: * javax.naming.directory.Attributes)
074: */
075: public DirContext createSubcontext(Name name, Attributes attributes)
076: throws NamingException {
077: // Auto-generated method stub
078: return null;
079: }
080:
081: /*
082: * (non-Javadoc)
083: *
084: * @see javax.naming.directory.DirContext#createSubcontext(java.lang.String,
085: * javax.naming.directory.Attributes)
086: */
087: public DirContext createSubcontext(String s, Attributes attributes)
088: throws NamingException {
089: // Auto-generated method stub
090: return null;
091: }
092:
093: /*
094: * (non-Javadoc)
095: *
096: * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
097: */
098: public Attributes getAttributes(Name name) throws NamingException {
099: // Auto-generated method stub
100: return null;
101: }
102:
103: /*
104: * (non-Javadoc)
105: *
106: * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name,
107: * java.lang.String[])
108: */
109: public Attributes getAttributes(Name name, String[] as)
110: throws NamingException {
111: // Auto-generated method stub
112: return null;
113: }
114:
115: /*
116: * (non-Javadoc)
117: *
118: * @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
119: */
120: public Attributes getAttributes(String s) throws NamingException {
121: // Auto-generated method stub
122: return null;
123: }
124:
125: /*
126: * (non-Javadoc)
127: *
128: * @see javax.naming.directory.DirContext#getAttributes(java.lang.String,
129: * java.lang.String[])
130: */
131: public Attributes getAttributes(String s, String[] as)
132: throws NamingException {
133: // Auto-generated method stub
134: return null;
135: }
136:
137: /*
138: * (non-Javadoc)
139: *
140: * @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
141: */
142: public DirContext getSchema(Name name) throws NamingException {
143: // Auto-generated method stub
144: return null;
145: }
146:
147: /*
148: * (non-Javadoc)
149: *
150: * @see javax.naming.directory.DirContext#getSchema(java.lang.String)
151: */
152: public DirContext getSchema(String s) throws NamingException {
153: // Auto-generated method stub
154: return null;
155: }
156:
157: /*
158: * (non-Javadoc)
159: *
160: * @see javax.naming.directory.DirContext#getSchemaClassDefinition(javax.naming.Name)
161: */
162: public DirContext getSchemaClassDefinition(Name name)
163: throws NamingException {
164: // Auto-generated method stub
165: return null;
166: }
167:
168: /*
169: * (non-Javadoc)
170: *
171: * @see javax.naming.directory.DirContext#getSchemaClassDefinition(java.lang.String)
172: */
173: public DirContext getSchemaClassDefinition(String s)
174: throws NamingException {
175: // Auto-generated method stub
176: return null;
177: }
178:
179: /*
180: * (non-Javadoc)
181: *
182: * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
183: * int, javax.naming.directory.Attributes)
184: */
185: public void modifyAttributes(Name name, int i, Attributes attributes)
186: throws NamingException {
187: // Auto-generated method stub
188:
189: }
190:
191: /*
192: * (non-Javadoc)
193: *
194: * @see javax.naming.directory.DirContext#modifyAttributes(javax.naming.Name,
195: * javax.naming.directory.ModificationItem[])
196: */
197: public void modifyAttributes(Name name,
198: ModificationItem[] amodificationitem)
199: throws NamingException {
200: // Auto-generated method stub
201:
202: }
203:
204: /*
205: * (non-Javadoc)
206: *
207: * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
208: * int, javax.naming.directory.Attributes)
209: */
210: public void modifyAttributes(String s, int i, Attributes attributes)
211: throws NamingException {
212: // Auto-generated method stub
213:
214: }
215:
216: /*
217: * (non-Javadoc)
218: *
219: * @see javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
220: * javax.naming.directory.ModificationItem[])
221: */
222: public void modifyAttributes(String s,
223: ModificationItem[] amodificationitem)
224: throws NamingException {
225: // Auto-generated method stub
226:
227: }
228:
229: /*
230: * (non-Javadoc)
231: *
232: * @see javax.naming.directory.DirContext#rebind(javax.naming.Name,
233: * java.lang.Object, javax.naming.directory.Attributes)
234: */
235: public void rebind(Name name, Object obj, Attributes attributes)
236: throws NamingException {
237: // Auto-generated method stub
238:
239: }
240:
241: /*
242: * (non-Javadoc)
243: *
244: * @see javax.naming.directory.DirContext#rebind(java.lang.String,
245: * java.lang.Object, javax.naming.directory.Attributes)
246: */
247: public void rebind(String s, Object obj, Attributes attributes)
248: throws NamingException {
249: // Auto-generated method stub
250:
251: }
252:
253: /*
254: * (non-Javadoc)
255: *
256: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
257: * javax.naming.directory.Attributes)
258: */
259: public NamingEnumeration<SearchResult> search(Name name,
260: Attributes attributes) throws NamingException {
261: // Auto-generated method stub
262: return null;
263: }
264:
265: /*
266: * (non-Javadoc)
267: *
268: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
269: * javax.naming.directory.Attributes, java.lang.String[])
270: */
271: public NamingEnumeration<SearchResult> search(Name name,
272: Attributes attributes, String[] as) throws NamingException {
273: // Auto-generated method stub
274: return null;
275: }
276:
277: /*
278: * (non-Javadoc)
279: *
280: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
281: * java.lang.String, java.lang.Object[],
282: * javax.naming.directory.SearchControls)
283: */
284: public NamingEnumeration<SearchResult> search(Name name, String s,
285: Object[] aobj, SearchControls searchcontrols)
286: throws NamingException {
287: // Auto-generated method stub
288: return null;
289: }
290:
291: /*
292: * (non-Javadoc)
293: *
294: * @see javax.naming.directory.DirContext#search(javax.naming.Name,
295: * java.lang.String, javax.naming.directory.SearchControls)
296: */
297: public NamingEnumeration<SearchResult> search(Name name, String s,
298: SearchControls searchcontrols) throws NamingException {
299: // Auto-generated method stub
300: return null;
301: }
302:
303: /*
304: * (non-Javadoc)
305: *
306: * @see javax.naming.directory.DirContext#search(java.lang.String,
307: * javax.naming.directory.Attributes)
308: */
309: public NamingEnumeration<SearchResult> search(String s,
310: Attributes attributes) throws NamingException {
311: // Auto-generated method stub
312: return null;
313: }
314:
315: /*
316: * (non-Javadoc)
317: *
318: * @see javax.naming.directory.DirContext#search(java.lang.String,
319: * javax.naming.directory.Attributes, java.lang.String[])
320: */
321: public NamingEnumeration<SearchResult> search(String s,
322: Attributes attributes, String[] as) throws NamingException {
323: // Auto-generated method stub
324: return null;
325: }
326:
327: /*
328: * (non-Javadoc)
329: *
330: * @see javax.naming.directory.DirContext#search(java.lang.String,
331: * java.lang.String, java.lang.Object[],
332: * javax.naming.directory.SearchControls)
333: */
334: public NamingEnumeration<SearchResult> search(String s, String s1,
335: Object[] aobj, SearchControls searchcontrols)
336: throws NamingException {
337: // Auto-generated method stub
338: return null;
339: }
340:
341: /*
342: * (non-Javadoc)
343: *
344: * @see javax.naming.directory.DirContext#search(java.lang.String,
345: * java.lang.String, javax.naming.directory.SearchControls)
346: */
347: public NamingEnumeration<SearchResult> search(String s, String s1,
348: SearchControls searchcontrols) throws NamingException {
349: // Auto-generated method stub
350: return null;
351: }
352:
353: /*
354: * (non-Javadoc)
355: *
356: * @see javax.naming.Context#addToEnvironment(java.lang.String,
357: * java.lang.Object)
358: */
359: public Object addToEnvironment(String s, Object o)
360: throws NamingException {
361: // Auto-generated method stub
362: return null;
363: }
364:
365: /*
366: * (non-Javadoc)
367: *
368: * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
369: */
370: public void bind(Name n, Object o) throws NamingException {
371: // Auto-generated method stub
372:
373: }
374:
375: /*
376: * (non-Javadoc)
377: *
378: * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
379: */
380: public void bind(String s, Object o) throws NamingException {
381: // Auto-generated method stub
382:
383: }
384:
385: /*
386: * (non-Javadoc)
387: *
388: * @see javax.naming.Context#close()
389: */
390: public void close() throws NamingException {
391: // Auto-generated method stub
392:
393: }
394:
395: /*
396: * (non-Javadoc)
397: *
398: * @see javax.naming.Context#composeName(javax.naming.Name,
399: * javax.naming.Name)
400: */
401: public Name composeName(Name n, Name pfx) throws NamingException {
402: // Auto-generated method stub
403: return null;
404: }
405:
406: /*
407: * (non-Javadoc)
408: *
409: * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
410: */
411: public String composeName(String s, String pfx)
412: throws NamingException {
413: // Auto-generated method stub
414: return null;
415: }
416:
417: /*
418: * (non-Javadoc)
419: *
420: * @see javax.naming.Context#createSubcontext(javax.naming.Name)
421: */
422: public Context createSubcontext(Name n) throws NamingException {
423: // Auto-generated method stub
424: return null;
425: }
426:
427: /*
428: * (non-Javadoc)
429: *
430: * @see javax.naming.Context#createSubcontext(java.lang.String)
431: */
432: public Context createSubcontext(String s) throws NamingException {
433: // Auto-generated method stub
434: return null;
435: }
436:
437: /*
438: * (non-Javadoc)
439: *
440: * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
441: */
442: public void destroySubcontext(Name n) throws NamingException {
443: // Auto-generated method stub
444:
445: }
446:
447: /*
448: * (non-Javadoc)
449: *
450: * @see javax.naming.Context#destroySubcontext(java.lang.String)
451: */
452: public void destroySubcontext(String s) throws NamingException {
453: // Auto-generated method stub
454:
455: }
456:
457: /*
458: * (non-Javadoc)
459: *
460: * @see javax.naming.Context#getEnvironment()
461: */
462: public Hashtable<String, Object> getEnvironment()
463: throws NamingException {
464: // Auto-generated method stub
465: return this .prop;
466: }
467:
468: /*
469: * (non-Javadoc)
470: *
471: * @see javax.naming.Context#getNameInNamespace()
472: */
473: public String getNameInNamespace() throws NamingException {
474: // Auto-generated method stub
475: return null;
476: }
477:
478: /*
479: * (non-Javadoc)
480: *
481: * @see javax.naming.Context#getNameParser(javax.naming.Name)
482: */
483: public NameParser getNameParser(Name n) throws NamingException {
484: // Auto-generated method stub
485: return null;
486: }
487:
488: /*
489: * (non-Javadoc)
490: *
491: * @see javax.naming.Context#getNameParser(java.lang.String)
492: */
493: public NameParser getNameParser(String s) throws NamingException {
494: // Auto-generated method stub
495: return null;
496: }
497:
498: /*
499: * (non-Javadoc)
500: *
501: * @see javax.naming.Context#list(javax.naming.Name)
502: */
503: public NamingEnumeration<NameClassPair> list(Name n)
504: throws NamingException {
505: // Auto-generated method stub
506: return null;
507: }
508:
509: /*
510: * (non-Javadoc)
511: *
512: * @see javax.naming.Context#list(java.lang.String)
513: */
514: public NamingEnumeration<NameClassPair> list(String s)
515: throws NamingException {
516: // Auto-generated method stub
517: return null;
518: }
519:
520: /*
521: * (non-Javadoc)
522: *
523: * @see javax.naming.Context#listBindings(javax.naming.Name)
524: */
525: public NamingEnumeration<Binding> listBindings(Name n)
526: throws NamingException {
527: // Auto-generated method stub
528: return null;
529: }
530:
531: /*
532: * (non-Javadoc)
533: *
534: * @see javax.naming.Context#listBindings(java.lang.String)
535: */
536: public NamingEnumeration<Binding> listBindings(String s)
537: throws NamingException {
538: // Auto-generated method stub
539: return null;
540: }
541:
542: /*
543: * (non-Javadoc)
544: *
545: * @see javax.naming.Context#lookup(javax.naming.Name)
546: */
547: public Object lookup(Name n) throws NamingException {
548: // Auto-generated method stub
549: return null;
550: }
551:
552: /*
553: * (non-Javadoc)
554: *
555: * @see javax.naming.Context#lookup(java.lang.String)
556: */
557: public Object lookup(String s) throws NamingException {
558: // Auto-generated method stub
559: return null;
560: }
561:
562: /*
563: * (non-Javadoc)
564: *
565: * @see javax.naming.Context#lookupLink(javax.naming.Name)
566: */
567: public Object lookupLink(Name n) throws NamingException {
568: // Auto-generated method stub
569: return null;
570: }
571:
572: /*
573: * (non-Javadoc)
574: *
575: * @see javax.naming.Context#lookupLink(java.lang.String)
576: */
577: public Object lookupLink(String s) throws NamingException {
578: // Auto-generated method stub
579: return null;
580: }
581:
582: /*
583: * (non-Javadoc)
584: *
585: * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
586: */
587: public void rebind(Name n, Object o) throws NamingException {
588: // Auto-generated method stub
589:
590: }
591:
592: /*
593: * (non-Javadoc)
594: *
595: * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
596: */
597: public void rebind(String s, Object o) throws NamingException {
598: // Auto-generated method stub
599:
600: }
601:
602: /*
603: * (non-Javadoc)
604: *
605: * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
606: */
607: public Object removeFromEnvironment(String s)
608: throws NamingException {
609: // Auto-generated method stub
610: return null;
611: }
612:
613: /*
614: * (non-Javadoc)
615: *
616: * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
617: */
618: public void rename(Name nOld, Name nNew) throws NamingException {
619: // Auto-generated method stub
620:
621: }
622:
623: /*
624: * (non-Javadoc)
625: *
626: * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
627: */
628: public void rename(String sOld, String sNew) throws NamingException {
629: // Auto-generated method stub
630:
631: }
632:
633: /*
634: * (non-Javadoc)
635: *
636: * @see javax.naming.Context#unbind(javax.naming.Name)
637: */
638: public void unbind(Name n) throws NamingException {
639: // Auto-generated method stub
640:
641: }
642:
643: /*
644: * (non-Javadoc)
645: *
646: * @see javax.naming.Context#unbind(java.lang.String)
647: */
648: public void unbind(String s) throws NamingException {
649: // Auto-generated method stub
650:
651: }
652:
653: /**
654: * @param object
655: * @param name
656: * @param context
657: * @param env
658: * @param a
659: * @return
660: */
661: public boolean parameterEquals(Object o, Name n, Context c,
662: Hashtable<?, ?> h, Attributes a) {
663: Hashtable<String, Object> r = new Hashtable<String, Object>();
664: if (null != o) {
665: r.put("o", o);
666: }
667: if (null != n) {
668: r.put("n", n);
669: }
670: if (null != c) {
671: r.put("c", c);
672: }
673: if (null != h) {
674: r.put("h", h);
675: }
676: if (null != a) {
677: r.put("a", a);
678: }
679: return r.equals(this .prop);
680: }
681:
682: @Override
683: public boolean equals(Object obj) {
684: if (!(obj instanceof MockDirContext3)) {
685: return false;
686: }
687: MockDirContext3 theOther = (MockDirContext3) obj;
688: return (null == prop ? null == theOther.prop : prop
689: .equals(theOther.prop));
690: }
691:
692: }
|