1 package de
.lohndirekt
.print
;
3 import java
.util
.Locale
;
5 import javax
.print
.DocFlavor
;
6 import javax
.print
.PrintService
;
7 import javax
.print
.attribute
.AttributeSet
;
8 import javax
.print
.attribute
.HashAttributeSet
;
9 import javax
.print
.attribute
.standard
.RequestingUserName
;
11 import de
.lohndirekt
.print
.attribute
.auth
.RequestingUserPassword
;
13 import junit
.framework
.TestCase
;
19 public class IppPrintServiceLookupTest
extends TestCase
{
22 * Constructor for IppPrintServiceLookupTest.
25 public IppPrintServiceLookupTest(String name
) {
30 * @see TestCase#setUp()
32 protected void setUp() throws Exception
{
34 //setting cups properties
35 System
.getProperties().setProperty(IppPrintServiceLookup
.URI_KEY
, Messages
.getString("cups.uri")); //$NON-NLS-1$
36 System
.getProperties().setProperty(IppPrintServiceLookup
.USERNAME_KEY
, Messages
.getString("cups.username")); //$NON-NLS-1$
37 System
.getProperties().setProperty(IppPrintServiceLookup
.PASSWORD_KEY
, Messages
.getString("cups.password")); //$NON-NLS-1$
38 System
.getProperties().setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog"); //$NON-NLS-1$
39 System
.getProperties().setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
40 System
.getProperties().setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
41 System
.getProperties().setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "debug");
44 // public void testGetServices(){
45 // PrintService[] services = new IppPrintServiceLookup().getPrintServices(DocFlavor.INPUT_STREAM.POSTSCRIPT ,null);
46 // assertTrue(services.length>0);
48 // //IppPrintServiceLookup must not return any pageable enabled services
49 // services = new IppPrintServiceLookup().getPrintServices(DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
50 // assertEquals(0,services.length);
55 public void testGetServicesAuthenticated(){
56 RequestingUserName user
= new RequestingUserName(Messages
.getString("cups.username"), Locale
.GERMANY
);
57 RequestingUserPassword pass
= new RequestingUserPassword(Messages
.getString("cups.password"), Locale
.GERMANY
);
59 AttributeSet set
= new HashAttributeSet();
63 PrintService
[] services
= new IppPrintServiceLookup().getPrintServices(DocFlavor
.INPUT_STREAM
.POSTSCRIPT
,null);
64 assertTrue(services
.length
>0);