Java Code Examples for org.apache.synapse.config.xml.MultiXMLConfigurationBuilder#PROXY_SERVICES_DIR

The following examples show how to use org.apache.synapse.config.xml.MultiXMLConfigurationBuilder#PROXY_SERVICES_DIR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProxyServiceStore.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({"ResultOfMethodCallIgnored"})
protected void deleteFile(String fileName, SynapseConfiguration synapseConfiguration) {
    File proxyDir = new File(configPath, MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR);
    if (!proxyDir.exists()) {
        return;
    }
    File proxyFile = new File(proxyDir, fileName);
    synapseConfiguration.getArtifactDeploymentStore().addBackedUpArtifact(
            proxyFile.getAbsolutePath());
    proxyFile.delete();
}
 
Example 2
Source File: ProxyServicePersistenceTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public void testProxyPersistence() throws IOException {
    System.out.println("Starting proxy persistence test...");

    String fileName = "proxy1.xml";
    InputStream in = getClass().getClassLoader().getResourceAsStream(fileName);
    ProxyService proxy = createProxy(in);
    in.close();
    proxy.setFileName(fileName);
    synapseConfigSvc.getSynapseConfiguration().addProxyService(proxy.getName(), proxy);
    getMediationPersistenceManager().saveItem(proxy.getName(),
            ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE);
    System.out.println("Added new proxy : " + proxy.getName());
    checkSavedProxy(proxy);

    if (proxy.getTargetInLineInSequence() != null) {
        proxy.getTargetInLineInSequence().addChild(new LogMediator());
        getMediationPersistenceManager().saveItem(proxy.getName(),
                ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE);
        System.out.println("Updated proxy : " + proxy.getName());
        checkSavedProxy(proxy);
    }

    synapseConfigSvc.getSynapseConfiguration().removeProxyService(proxy.getName());
    getMediationPersistenceManager().deleteItem(proxy.getName(), fileName,
            ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE);
    System.out.println("Proxy : " + proxy.getName() + " removed");
    hold();

    File file = new File(path + File.separator +
            MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR, fileName);
    if (file.exists()) {
        fail("The file : " + fileName + " has not been deleted");
    }
    System.out.println("Proxy service file : " + fileName + " deleted successfully");

    checkSynapseXMLPersistence();

    System.out.println("Proxy service persistence test completed successfully...");
}