@Test public void testSetConfiguration() throws Exception { final Host host = new Host(new AzureProtocol(), "kahy9boj3eib.blob.core.windows.net", new Credentials( System.getProperties().getProperty("azure.account"), System.getProperties().getProperty("azure.key") )); final AzureSession session = new AzureSession(host); new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener()).connect(session, PathCache.empty(), new DisabledCancelCallback()); final Path container = new Path("/cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory)); final AzureLoggingFeature feature = new AzureLoggingFeature(session, null); feature.setConfiguration(container, new LoggingConfiguration(false)); assertFalse(feature.getConfiguration(container).isEnabled()); feature.setConfiguration(container, new LoggingConfiguration(true)); assertTrue(feature.getConfiguration(container).isEnabled()); session.close(); }
@Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingProperties l = new LoggingProperties(); if(configuration.isEnabled()) { l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); } else { l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); } properties.setLogging(l); session.getClient().uploadServiceProperties(properties, null, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container); } }
AzureLoggingFeature implements Logging { @Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingProperties l = new LoggingProperties(); if(configuration.isEnabled()) { l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); } else { l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); } properties.setLogging(l); session.getClient().uploadServiceProperties(properties, null, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container); } } }
AzureLoggingFeature implements Logging { @Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingProperties l = new LoggingProperties(); if(configuration.isEnabled()) { l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); } else { l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); } properties.setLogging(l); session.getClient().uploadServiceProperties(properties, null, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container); } } AzureLoggingFeature(final AzureSession session, final OperationContext context); }
AzureLoggingFeature implements Logging { @Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingProperties l = new LoggingProperties(); if(configuration.isEnabled()) { l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); } else { l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); } properties.setLogging(l); session.getClient().uploadServiceProperties(properties, null, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container); } } AzureLoggingFeature(final AzureSession session, final OperationContext context); @Override LoggingConfiguration getConfiguration(final Path container); @Override void setConfiguration(final Path container, final LoggingConfiguration configuration); }
AzureLoggingFeature implements Logging { @Override public void setConfiguration(final Path container, final LoggingConfiguration configuration) throws BackgroundException { try { final ServiceProperties properties = session.getClient().downloadServiceProperties(null, context); final LoggingProperties l = new LoggingProperties(); if(configuration.isEnabled()) { l.setLogOperationTypes(EnumSet.allOf(LoggingOperations.class)); } else { l.setLogOperationTypes(EnumSet.noneOf(LoggingOperations.class)); } properties.setLogging(l); session.getClient().uploadServiceProperties(properties, null, context); } catch(StorageException e) { throw new AzureExceptionMappingService().map("Failure to write attributes of {0}", e, container); } } AzureLoggingFeature(final AzureSession session, final OperationContext context); @Override LoggingConfiguration getConfiguration(final Path container); @Override void setConfiguration(final Path container, final LoggingConfiguration configuration);  }