SoapUIProjectImporter implements MockRepositoryImporter { @Override public List<Service> getServiceDefinitions() throws MockRepositoryImportException { List<Service> result = new ArrayList<>(); result.addAll(getSoapServiceDefinitions(project.getMockServiceList())); result.addAll(getRestServiceDefinitions(project.getRestMockServiceList())); return result; } SoapUIProjectImporter(String projectFilePath); @Override List<Service> getServiceDefinitions(); @Override List<Resource> getResourceDefinitions(Service service); @Override List<Exchange> getMessageDefinitions(Service service, Operation operation); static final String SERVICE_VERSION_PROPERTY; }
@Test public void testSimpleProjectNoVersionImport() { SoapUIProjectImporter importer = null; try { importer = new SoapUIProjectImporter("target/test-classes/io/github/microcks/util/soapui/RefTest-no-version-soapui-project.xml"); } catch (Exception e) { fail("Exception should not be thrown"); } boolean failure = false; List<Service> services = null; try { services = importer.getServiceDefinitions(); } catch (MockRepositoryImportException e) { failure = true; assertNotEquals(-1, e.getMessage().indexOf("Version property")); } assertTrue(failure); }
@Test public void testHelloAPIProjectImport() { MockRepositoryImporter importer = null; try { importer = MockRepositoryImporterFactory.getMockRepositoryImporter( new java.io.File("target/test-classes/io/github/microcks/util/soapui/HelloAPI-soapui-project.xml")); } catch (Exception e) { fail("Exception should not be thrown"); } List<Service> services = null; try { services = importer.getServiceDefinitions(); } catch (MockRepositoryImportException e) { fail("Exception should not be thrown"); } assertEquals(1, services.size()); }