EnvironmentManagerSecureProxy extends HostListener implements EnvironmentManager, PeerActionListener, AlertListener, SecureEnvironmentManager, BazaarEventListener,
        LocalPeerEventListener { @Override @RolesAllowed( "Environment-Management|Update" ) public void addSshKey( final String environmentId, final String sshKey, final boolean async ) throws EnvironmentNotFoundException, EnvironmentModificationException { checkEnvironmentPermission( environmentId, traitsBuilder( "ownership=All;update=true" ) ); environmentManager.addSshKey( environmentId, sshKey, async ); } EnvironmentManagerSecureProxy( final TemplateManager templateManager, final PeerManager peerManager,
                                          SecurityManager securityManager, final IdentityManager identityManager,
                                          final Tracker tracker, final RelationManager relationManager,
                                          final BazaaarAdapter bazaaarAdapter,
                                          final EnvironmentService environmentService,
                                          final SystemManager systemManager ); void init(); void dispose(); void registerListener( final EnvironmentEventListener listener ); void unregisterListener( final EnvironmentEventListener listener ); @Override Set<Environment> getEnvironments(); @PermitAll @Override Set<Environment> getEnvironmentsByOwnerId( final long userId ); @Override @RolesAllowed( "Environment-Management|Write" ) EnvironmentCreationRef createEnvironment( final Topology topology, final boolean async ); @Override @RolesAllowed( "Environment-Management|Write" ) EnvironmentCreationRef modifyEnvironment( final String environmentId, final Topology topology,
                                                     final Set<String> removedContainers,
                                                     final Map<String, ContainerQuota> changedContainers,
                                                     final boolean async ); @Override @RolesAllowed( "Environment-Management|Write" ) Set<EnvironmentContainerHost> growEnvironment( final String environmentId, final Topology topology,
                                                          final boolean async ); @Override @RolesAllowed( "Environment-Management|Update" ) void addSshKey( final String environmentId, final String sshKey, final boolean async ); @Override @RolesAllowed( "Environment-Management|Update" ) void removeSshKey( final String environmentId, final String sshKey, final boolean async ); @Override SshKeys getSshKeys( final String environmentId, final SshEncryptionType encType ); @Override SshKeys createSshKey( final String environmentId, final String hostname, final SshEncryptionType encType ); @Override @RolesAllowed( { "Environment-Management|Update", "System-Management|Write", "System-Management|Update" } ) void resetP2PSecretKey( final String environmentId, final String newP2pSecretKey,
                                   final long p2pSecretKeyTtlSec, final boolean async ); @Override @RolesAllowed( { "Environment-Management|Delete", "Tenant-Management|Delete" } ) void destroyEnvironment( final String environmentId, final boolean async ); @Override @RolesAllowed( "Environment-Management|Delete" ) void destroyContainer( final String environmentId, final String containerId, final boolean async ); @Override void cancelEnvironmentWorkflow( final String environmentId ); @Override Map<String, CancellableWorkflow> getActiveWorkflows(); @Override @PermitAll Environment loadEnvironment( final String environmentId ); @Override @RolesAllowed( "Environment-Management|Update" ) SshTunnel setupSshTunnelForContainer( final String containerHostId, final String environmentId ); @Override @PermitAll void notifyOnContainerDestroyed( final Environment environment, final String containerId ); @PermitAll @Override void notifyOnEnvironmentDestroyed( final String environmentId ); @Override void addAlertHandler( final AlertHandler alertHandler ); @Override void removeAlertHandler( final AlertHandler alertHandler ); @Override Collection<AlertHandler> getRegisteredAlertHandlers(); @Override EnvironmentAlertHandlers getEnvironmentAlertHandlers( final EnvironmentId environmentId ); @Override List<ShareDto> getSharedUsers( final String objectId ); @Override @RolesAllowed( "Environment-Management|Update" ) void shareEnvironment( final ShareDto[] shareDto, final String environmentId ); @Override void startMonitoring( final String handlerId, final AlertHandlerPriority handlerPriority,
                                 final String environmentId ); @Override void stopMonitoring( final String handlerId, final AlertHandlerPriority handlerPriority,
                                final String environmentId ); @Override String getId(); @Override void onAlert( final AlertEvent alertEvent ); @Override String getName(); @Override PeerActionResponse onPeerAction( final PeerAction peerAction ); @Override void onRegistrationSucceeded(); @Override void onUnregister(); @RolesAllowed( "Environment-Management|Update" ) @Override void changeContainerHostname( final ContainerId containerId, final String newHostname, final boolean async ); @RolesAllowed( "Environment-Management|Update" ) @Override void addSshKeyToEnvironmentEntity( final String environmentId, final String sshKey ); @RolesAllowed( "Environment-Management|Delete" ) @Override void excludePeerFromEnvironment( final String environmentId, final String peerId ); @RolesAllowed( "Environment-Management|Delete" ) @Override void excludeContainerFromEnvironment( final String environmentId, final String containerId ); @RolesAllowed( "Environment-Management|Update" ) @Override void updateContainerHostname( final String environmentId, final String containerId, final String hostname ); @Override @RolesAllowed( "Tenant-Management|Read" ) Set<EnvironmentDto> getTenantEnvironments(); @Override @PermitAll boolean rhHasEnvironments( final String rhId ); @Override String getEnvironmentOwnerName( final Environment environment ); @Override void onHeartbeat( final ResourceHostInfo resourceHostInfo, final Set<QuotaAlertValue> alerts ); @Override void onContainerStateChanged( final ContainerHostInfo containerInfo, final ContainerHostState previousState,
                                         final ContainerHostState currentState ); @Override void onContainerHostnameChanged( final ContainerHostInfo containerInfo, final String previousHostname,
                                            final String currentHostname ); @Override void onContainerCreated( final ContainerHostInfo containerInfo ); @Override void onContainerDestroyed( final ContainerHostInfo containerInfo ); @Override void onRhConnected( final ResourceHostInfo resourceHostInfo ); @Override void onRhDisconnected( final ResourceHostInfo resourceHostInfo ); @Override Set<String> getDeletedEnvironmentsFromBazaar(); @Override void placeEnvironmentInfoByContainerIp( final String containerIp ); @Override void placeEnvironmentInfoByContainerId( final String environmentId, final String containerId ); @Override void createTemplate( final String environmentId, final String containerId, final String templateName,
                                final String version, final boolean privateTemplate ); @Override void onContainerDestroyed( final ContainerHost containerHost ); @Override Environment getEnvironment( final String environmentId );  }
@Test public void testAddSshKey() throws Exception { proxy.addSshKey( TestHelper.ENV_ID, TestHelper.SSH_KEY, true ); verify( environmentManager ).addSshKey( TestHelper.ENV_ID, TestHelper.SSH_KEY, true ); }