@Test public void testExternalExports() { TestApplicationTemplate tpl = new TestApplicationTemplate(); Application app = new Application( tpl ); Assert.assertEquals( app.getExternalExports(), tpl.externalExports ); tpl.externalExports.put( "something", "here" ); Assert.assertEquals( app.getExternalExports(), tpl.externalExports ); }
Message msg = new MsgCmdSetScopedInstance( scopedInstance, app.getExternalExports(), app.getApplicationBindings(), scriptResources);
@Override public void propagateAgentTermination( Application application, Instance rootInstance ) throws IOException { // Start with the deepest instances List<Instance> instances = InstanceHelpers.buildHierarchicalList( rootInstance ); Collections.reverse( instances ); // Roughly, we unpublish all the variables for all the instances that were on the agent's machine. // This code is VERY similar to ...ClientAgent#unpublishExports // The messages will go through JUST like if they were coming from other agents. this.logger.fine( "The DM is un-publishing exports related to agent of " + rootInstance + " (termination propagation)." ); for( Instance instance : instances ) { for( MessagingContext ctx : MessagingContext.forExportedVariables( this.domain, application.getName(), instance, application.getExternalExports(), ThoseThat.IMPORT )) { MsgCmdRemoveImport message = new MsgCmdRemoveImport( application.getName(), ctx.getComponentOrFacetName(), InstanceHelpers.computeInstancePath( instance )); // FIXME: external exports are not handled here!!!! getMessagingClient().publish( ctx, message ); } } }
@Override public void propagateAgentTermination( Application application, Instance rootInstance ) throws IOException { // Start with the deepest instances List<Instance> instances = InstanceHelpers.buildHierarchicalList( rootInstance ); Collections.reverse( instances ); // Roughly, we unpublish all the variables for all the instances that were on the agent's machine. // This code is VERY similar to ...ClientAgent#unpublishExports // The messages will go through JUST like if they were coming from other agents. this.logger.fine( "The DM is un-publishing exports related to agent of " + rootInstance + " (termination propagation)." ); for( Instance instance : instances ) { for( MessagingContext ctx : MessagingContext.forExportedVariables( this.domain, application.getName(), instance, application.getExternalExports(), ThoseThat.IMPORT )) { MsgCmdRemoveImport message = new MsgCmdRemoveImport( application.getName(), ctx.getComponentOrFacetName(), InstanceHelpers.computeInstancePath( instance )); // FIXME: external exports are not handled here!!!! getMessagingClient().publish( ctx, message ); } } }
@Test public void testShortcuts() { Application app = new Application( null ); Assert.assertNull( app.getGraphs()); Assert.assertNotNull( app.getExternalExports()); Assert.assertEquals( 0, app.getExternalExports().size()); app = new TestApplication(); Assert.assertNotNull( app.getGraphs()); Assert.assertNotNull( app.getExternalExports()); }
MsgCmdSetScopedInstance msgModel = new MsgCmdSetScopedInstance( scopedInstance, ma.getApplication().getExternalExports(), ma.getApplication().getApplicationBindings(), scriptResources );
agentClient.setApplicationName( app.getName()); agentClient.setScopedInstancePath( "/" + rootInstance.getName()); agentClient.setExternalMapping( app.getExternalExports()); agentClient.switchMessagingType( getMessagingType()); this.clients.add( agentClient );
client1.setApplicationName( app.getName()); client1.setScopedInstancePath( "/" + instance1.getName()); client1.setExternalMapping( app.getExternalExports()); client1.switchMessagingType( getMessagingType()); this.clients.add( client1 ); client2.setApplicationName( app.getName()); client2.setScopedInstancePath( "/" + instance2.getName()); client2.setExternalMapping( app.getExternalExports()); client2.switchMessagingType( getMessagingType()); this.clients.add( client2 );
agentClient_11.setApplicationName( app1.getName()); agentClient_11.setScopedInstancePath( "/" + app1_root1.getName()); agentClient_11.setExternalMapping( app1.getExternalExports()); agentClient_11.switchMessagingType( getMessagingType()); this.clients.add( agentClient_11 ); agentClient_12.setApplicationName( app1.getName()); agentClient_12.setScopedInstancePath( "/" + app1_root2.getName()); agentClient_12.setExternalMapping( app1.getExternalExports()); agentClient_12.switchMessagingType( getMessagingType()); this.clients.add( agentClient_12 ); agentClient_2.setApplicationName( app2.getName()); agentClient_2.setScopedInstancePath( "/" + app2_root.getName()); agentClient_2.setExternalMapping( app2.getExternalExports()); agentClient_2.switchMessagingType( getMessagingType()); this.clients.add( agentClient_2 );
tomcatClient.setApplicationName( app1.getName()); tomcatClient.setScopedInstancePath( "/" + tomcat.getName()); tomcatClient.setExternalMapping( app1.getExternalExports()); tomcatClient.switchMessagingType( getMessagingType()); this.clients.add( tomcatClient ); apacheClient.setApplicationName( app1.getName()); apacheClient.setScopedInstancePath( "/" + apache.getName()); apacheClient.setExternalMapping( app1.getExternalExports()); apacheClient.switchMessagingType( getMessagingType()); this.clients.add( apacheClient ); mySqlClient.setApplicationName( app1.getName()); mySqlClient.setScopedInstancePath( "/" + mysql.getName()); mySqlClient.setExternalMapping( app1.getExternalExports()); mySqlClient.switchMessagingType( getMessagingType()); this.clients.add( mySqlClient ); otherClient.setApplicationName( app2.getName()); otherClient.setScopedInstancePath( "/" + other.getName()); otherClient.setExternalMapping( app2.getExternalExports()); otherClient.switchMessagingType( getMessagingType()); this.clients.add( otherClient );
tomcatClient.setApplicationName( app1.getName()); tomcatClient.setScopedInstancePath( "/" + tomcat.getName()); tomcatClient.setExternalMapping( app1.getExternalExports()); tomcatClient.switchMessagingType( getMessagingType()); this.clients.add( tomcatClient ); apacheClient.setApplicationName( app1.getName()); apacheClient.setScopedInstancePath( "/" + apache.getName()); apacheClient.setExternalMapping( app1.getExternalExports()); apacheClient.switchMessagingType( getMessagingType()); this.clients.add( apacheClient ); mySqlClient.setApplicationName( app1.getName()); mySqlClient.setScopedInstancePath( "/" + mysql.getName()); mySqlClient.setExternalMapping( app1.getExternalExports()); mySqlClient.switchMessagingType( getMessagingType()); this.clients.add( mySqlClient ); otherClient.setApplicationName( app2.getName()); otherClient.setScopedInstancePath( "/" + other.getName()); otherClient.setExternalMapping( app2.getExternalExports()); otherClient.switchMessagingType( getMessagingType()); this.clients.add( otherClient );
tomcatClient.setApplicationName( app1.getName()); tomcatClient.setScopedInstancePath( "/" + tomcat.getName()); tomcatClient.setExternalMapping( app1.getExternalExports()); tomcatClient.switchMessagingType( getMessagingType()); tomcatClient.listenToTheDm( ListenerCommand.START ); apacheClient.setApplicationName( app1.getName()); apacheClient.setScopedInstancePath( "/" + apache.getName()); apacheClient.setExternalMapping( app1.getExternalExports()); apacheClient.switchMessagingType( getMessagingType()); apacheClient.listenToTheDm( ListenerCommand.START ); mySqlClient.setApplicationName( app1.getName()); mySqlClient.setScopedInstancePath( "/" + mysql.getName()); mySqlClient.setExternalMapping( app1.getExternalExports()); mySqlClient.switchMessagingType( getMessagingType()); mySqlClient.listenToTheDm( ListenerCommand.START ); otherClient.setApplicationName( app2.getName()); otherClient.setScopedInstancePath( "/" + other.getName()); otherClient.setExternalMapping( app2.getExternalExports()); otherClient.switchMessagingType( getMessagingType()); otherClient.listenToTheDm( ListenerCommand.START );