1 19 package org.netbeans.modules.websvc.wsitconf.wsdlmodelext; 20 21 import java.io.File ; 22 import java.util.Collection ; 23 import junit.framework.*; 24 import org.netbeans.junit.NbTestCase; 25 import org.netbeans.modules.websvc.wsitconf.ui.ComboConstants; 26 import org.netbeans.modules.websvc.wsitconf.util.TestCatalogModel; 27 import org.netbeans.modules.websvc.wsitconf.util.TestUtil; 28 import org.netbeans.modules.websvc.wsitmodelext.policy.All; 29 import org.netbeans.modules.websvc.wsitmodelext.policy.PolicyReference; 30 import org.netbeans.modules.xml.wsdl.model.Binding; 31 import org.netbeans.modules.xml.wsdl.model.BindingOperation; 32 import org.netbeans.modules.xml.wsdl.model.Definitions; 33 import org.netbeans.modules.xml.wsdl.model.WSDLComponentFactory; 34 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 35 36 40 public class ProfileTest extends NbTestCase { 41 42 public ProfileTest(String testName) { 43 super(testName); 44 } 45 46 @Override 47 protected void setUp() throws Exception { 48 clearWorkDir(); 49 } 50 51 @Override 52 protected void tearDown() throws Exception { 53 TestCatalogModel.getDefault().setDocumentPooling(false); 54 } 55 56 public void testWrite() throws Exception { 57 TestCatalogModel.getDefault().setDocumentPooling(true); 58 WSDLModel model = TestUtil.loadWSDLModel("../wsdlmodelext/resources/policy.xml"); 59 WSDLComponentFactory fact = model.getFactory(); 60 61 Definitions d = model.getDefinitions(); 62 Binding b = (Binding) d.getBindings().toArray()[0]; 63 64 String [] profiles = new String [] { 65 "", 66 ComboConstants.PROF_TRANSPORT, 67 ComboConstants.PROF_MSGAUTHSSL, 68 ComboConstants.PROF_SAMLSSL, 69 ComboConstants.PROF_USERNAME, 70 ComboConstants.PROF_MUTUALCERT, 71 ComboConstants.PROF_ENDORSCERT, 72 ComboConstants.PROF_SAMLSENDER, 73 ComboConstants.PROF_SAMLHOLDER, 74 ComboConstants.PROF_KERBEROS, 75 ComboConstants.PROF_STSISSUED, 76 ComboConstants.PROF_STSISSUEDCERT, 77 ComboConstants.PROF_STSISSUEDENDORSE 78 }; 79 80 for (int i=1; i<profiles.length; i++) { 81 String profile = profiles[i]; 82 83 ProfilesModelHelper.setSecurityProfile(b, profile); 85 86 File profDefaultFile = new File (getWorkDirPath() + File.separator + i + profile + ".wsdl"); 87 TestUtil.dumpToFile(model.getBaseDocument(), profDefaultFile); 88 90 ProfilesModelHelper.enableSecureConversation(b, true, profile); 92 File profSCFile = new File (getWorkDirPath() + File.separator + i + profile + "-SecureConversation.wsdl"); 93 TestUtil.dumpToFile(model.getBaseDocument(), profSCFile); 94 96 ProfilesModelHelper.enableSecureConversation(b, false, profile); 98 File profAfterSCFile = new File (getWorkDirPath() + File.separator + i + profile + "-After.wsdl"); 99 TestUtil.dumpToFile(model.getBaseDocument(), profAfterSCFile); 100 102 readAndCheck(model, profile); 103 } 104 105 } 106 107 private void readAndCheck(WSDLModel model, String profile) { 108 109 112 } 113 114 public String getTestResourcePath() { 115 return "../wsdlmodelext/resources/policy.xml"; 116 } 117 118 } 119 | Popular Tags |