- Timestamp:
- 01/08/11 12:22:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKBJavaConnector/HLOKBWebClient/src/test/java/at/hl/okb/wsclient/OKBClientTest.java
r5242 r5243 1 1 package at.hl.okb.wsclient; 2 2 3 import static org.junit.Assert.assertTrue; 3 4 4 import junit.framework.Assert; 5 import org.junit.After; 6 import org.junit.AfterClass; 7 import org.junit.Before; 8 import org.junit.BeforeClass; 9 import org.junit.Test; 5 10 6 import org.junit.Test; 11 import at.hl.okb.wsclient.Exception.OKBWebServiceFailedException; 12 import at.hl.wsclient.okb.AddAlgorithm; 13 import at.hl.wsclient.okb.Algorithm; 14 import at.hl.wsclient.okb.ArrayOfAlgorithm; 15 import at.hl.wsclient.okb.ArrayOfDataType; 16 import at.hl.wsclient.okb.DataType; 17 import at.hl.wsclient.okb.IOKBService; 18 import at.hl.wsclient.okb.OKBService; 19 import at.hl.wsclient.okb.ObjectFactory; 20 import at.hl.wsclient.okb.Platform; 7 21 8 22 /** 9 23 * @author HolperM 10 * 24 * 11 25 */ 12 26 public class OKBClientTest { 13 14 15 OKBServiceClient client = new OKBServiceClient(); 27 28 OKBService srv = null; 29 IOKBService port = null; 30 31 /** 32 * @throws java.lang.Exception 33 */ 34 @BeforeClass 35 public static void setUpBeforeClass() throws Exception { 36 } 37 38 /** 39 * @throws java.lang.Exception 40 */ 41 @AfterClass 42 public static void tearDownAfterClass() throws Exception { 43 } 44 45 /** 46 * @throws java.lang.Exception 47 */ 48 @Before 49 public void setUp() throws Exception { 50 this.srv = new OKBService(); 51 this.port = srv.getWSHttpBindingIOKBService1(); 52 } 53 54 /** 55 * @throws java.lang.Exception 56 */ 57 @After 58 public void tearDown() throws Exception { 59 } 60 16 61 @Test 17 public void testGetPlatform() 18 { 19 Assert.assertNotNull(client.getPlatformId("ECJ")); 62 public void AddAlgorithmTest() throws Exception { 63 64 ObjectFactory fac = new ObjectFactory(); 65 AddAlgorithm addA = fac.createAddAlgorithm(); 66 addA.setDto(fac.createAddAlgorithmDto(fac.createAlgorithm())); 67 Long retval = 0L; 68 69 // if (port.getAlgorithm(2L)!=null) 70 // port.deleteAlgorithm(2L); 71 72 73 Algorithm a = fac.createAlgorithm(); 74 a.setAlgorithmClassId(1L); 75 a.setDescription(fac.createNamedOKBItemDescription("a new Algo")); 76 a.setId(2L); 77 a.setName(fac.createNamedOKBItemName("Algorithm Name 6")); 78 a.setPlatformId(1L); 79 try { 80 retval = port.addAlgorithm(a); 81 } catch (Exception e) { 82 throw new OKBWebServiceFailedException(e.getMessage()); 83 } 84 assertTrue("Algortihm wasn't added", retval > 0); 85 } 86 87 @Test 88 public void GetAlgorithmsTest() { 89 90 ArrayOfAlgorithm algos = port.getAlgorithms(); 91 92 for (Algorithm algo : algos.getAlgorithm()) { 93 System.out.println("algo ClassId:=" + algo.getAlgorithmClassId()); 94 System.out.println("algo Id:=" + algo.getId()); 95 System.out.println("algo PlattformId:=" + algo.getPlatformId()); 96 System.out.println("algo Class:=" + algo.getClass()); 97 System.out.println("algo Description:=" 98 + algo.getDescription().getValue()); 99 System.out.println("algo Name:=" + algo.getName().getValue()); 100 } 101 assertTrue("No Algorithms found!", algos.getAlgorithm().size() > 0); 102 } 103 104 @Test 105 public void GetDataTypesTest() { 106 107 ArrayOfDataType dataTypes = port.getDataTypes(); 108 109 for (DataType dataType : dataTypes.getDataType()) { 110 System.out.println("algo Id:=" + dataType.getId()); 111 System.out.println("algo platformId:=" + dataType.getPlatformId()); 112 System.out.println("algo Name:=" + dataType.getName()); 113 System.out.println("algo Class:=" + dataType.getClass()); 114 System.out.println("algo SQLName:=" 115 + dataType.getSqlName().getValue()); 116 } 117 assertTrue("No dataTypes found!", dataTypes.getDataType().size() > 0); 118 } 119 120 @Test 121 public void GetPlatFormTest() { 122 Platform f = port.getPlatform(1L); 123 assertTrue(f.getName().getValue().length() > 0); 124 } 125 126 OKBServiceClient client = new OKBServiceClient(); 127 128 @Test 129 public void testGetPlatform() { 130 client.getPlatformId("ECJ"); 20 131 } 21 132 22 @Test23 public void testGetProblemClass()24 {25 Assert.assertNotNull(client.getProblemClassId("ECJ"));26 }27 @Test28 public void testGetAlgorithmClass()29 {30 Assert.assertNotNull(client.getAlgorithmClassId("ECJ"));31 }32 133 33 134 }
Note: See TracChangeset
for help on using the changeset viewer.