--- a/jdk/test/javax/print/attribute/PSCopiesFlavorTest.java Wed Apr 15 08:47:21 2009 -0700
+++ b/jdk/test/javax/print/attribute/PSCopiesFlavorTest.java Mon Apr 20 12:31:36 2009 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,26 +37,26 @@
public static void main(String args[]) {
DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
- PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
- if (!(ps.isDocFlavorSupported(flavor))) {
- System.out.println("unsupported flavor :" + flavor);
- return;
+ PrintService[] ps = PrintServiceLookup.lookupPrintServices(flavor, null);
+ if (ps.length > 0) {
+ System.out.println("found PrintService: "+ps[0]);
+ Copies c = new Copies(1);
+ PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+ aset.add(c);
+ boolean suppVal = ps[0].isAttributeValueSupported(c, flavor, null);
+ AttributeSet us = ps[0].getUnsupportedAttributes(flavor, aset);
+ if (suppVal || us == null) {
+ throw new RuntimeException("Copies should be unsupported value");
+ }
+
+ Object value = ps[0].getSupportedAttributeValues(Copies.class,
+ flavor, null);
+
+ //Copies Supported
+ if(value instanceof CopiesSupported) {
+ throw new RuntimeException("Copies should have no supported values.");
+ }
}
- Copies c = new Copies(1);
- PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
- aset.add(c);
- boolean suppVal = ps.isAttributeValueSupported(c, flavor, null);
- AttributeSet us = ps.getUnsupportedAttributes(flavor, aset);
- if (suppVal || us == null) {
- throw new RuntimeException("Copies should be unsupported value");
- }
-
- Object value = ps.getSupportedAttributeValues(Copies.class, flavor, null);
-
- //Copies Supported
- if(value instanceof CopiesSupported) {
- throw new RuntimeException("Copies should have no supported values.");
- }
}
}