View Javadoc

1   /*
2    * $Id: GWESGlobusProxyTest.java 1532 2011-06-23 15:57:53Z hoheisel $
3    *
4    * Copyright (c) 2007
5    * Fraunhofer Institute for Computer Architecture and Software Technology
6    * See http://www.first.fraunhofer.de for more details.
7    */
8   
9   package net.kwfgrid.gwes;
10  
11  import junit.framework.Assert;
12  import junit.framework.Test;
13  import junit.framework.TestSuite;
14  import net.kwfgrid.gwes.client.GWESClient;
15  import net.kwfgrid.gwes.exception.LoggingException;
16  import net.kwfgrid.gwes.util.StringUtils;
17  import org.apache.log4j.Logger;
18  import org.ietf.jgss.GSSException;
19  
20  import java.io.IOException;
21  
22  /**
23   * This test only works with a valid globus credential proxy.
24   * @author Andreas Hoheisel
25   *         (<a href="http://www.andreas-hoheisel.de">www.andreas-hoheisel.de</a>)
26   * @version $Id: GWESGlobusProxyTest.java 1532 2011-06-23 15:57:53Z hoheisel $
27   */
28  public final class GWESGlobusProxyTest extends LocalGWESAbstractTestCase {
29  
30      static Logger logger = Logger.getLogger(GWESGlobusProxyTest.class);
31  
32      /**
33       * Create the test case.
34       *
35       * @param testName name of the test case
36       */
37      public GWESGlobusProxyTest(String testName) throws LoggingException {
38          super(testName);
39      }
40  
41      /**
42       * @return the suite of tests being tested
43       */
44      public static Test suite() {
45          return new TestSuite(GWESGlobusProxyTest.class);
46      }
47  
48      public void testCredential() throws IOException, GSSException, LoggingException {
49  
50          CredentialManager credentialManager = new CredentialManager();
51          String dn = credentialManager.getDN();
52          logger.info("DN1="+dn);
53          String cn = credentialManager.getFilteredCN();
54          logger.info("CN1="+cn);
55  
56          String userIdCredential = GWESClient.getUserIDWithCredential(System.getProperty("user.name", "nn"));
57          CredentialManager credentialManager2 = new CredentialManager(userIdCredential);
58          String dn2 = credentialManager2.getDN();
59          logger.info("DN2="+dn);
60          String cn2 = credentialManager2.getFilteredCN();
61          logger.info("CN2="+cn);
62          Assert.assertEquals("DN",dn,dn2);
63          Assert.assertEquals("CN",cn,cn2);
64      }
65  
66      /**
67       * *******************************************************************************************
68       * End of public test classes.
69       * ********************************************************************************************
70       */
71  
72  }