|
38 | 38 | let(:credentials) { {} } |
39 | 39 |
|
40 | 40 | before do |
41 | | - allow(services).to receive(:one_service?).with(/introscope/, 'host-name').and_return(true) |
| 41 | + allow(services).to receive(:one_service?).with(/introscope/, 'url').and_return(true) |
42 | 42 | allow(services).to receive(:find_service).and_return('credentials' => credentials) |
43 | 43 | end |
44 | 44 |
|
45 | 45 | it 'detects with introscope-n/a service' do |
46 | 46 | expect(component.detect).to eq("introscope-agent=#{version}") |
47 | 47 | end |
48 | 48 |
|
49 | | - it 'expands Introscope agent zip', |
50 | | - cache_fixture: 'stub-introscope-agent.tar' do |
| 49 | + it 'expands Introscope agent zip', cache_fixture: 'stub-introscope-agent.tar' do |
51 | 50 |
|
52 | 51 | component.compile |
53 | 52 |
|
54 | 53 | expect(sandbox + 'Agent.jar').to exist |
55 | 54 | end |
56 | 55 |
|
57 | 56 | context do |
| 57 | + let(:credentials) { { 'agent-name' => 'another-test-agent-name', 'url' => 'default-host:5001' } } |
58 | 58 |
|
59 | | - let(:credentials) { { 'host-name' => 'test-host-name' } } |
| 59 | + it 'adds agent-name from credentials to JAVA_OPTS if specified' do |
| 60 | + component.release |
| 61 | + |
| 62 | + expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=another-test-agent-name') |
| 63 | + end |
| 64 | + end |
| 65 | + |
| 66 | + context do |
60 | 67 |
|
61 | | - it 'updates JAVA_OPTS' do |
| 68 | + let(:credentials) { { 'url' => 'test-host-name:5001' } } |
| 69 | + |
| 70 | + it 'parses the url and sets host port and default socket factory' do |
62 | 71 | component.release |
63 | 72 |
|
64 | 73 | expect(java_opts).to include('-javaagent:$PWD/.java-buildpack/introscope_agent/Agent.jar') |
65 | 74 | expect(java_opts).to include('-Dcom.wily.introscope.agentProfile=$PWD/.java-buildpack/introscope_agent/core' \ |
66 | 75 | '/config/IntroscopeAgent.profile') |
67 | 76 | expect(java_opts).to include('-Dintroscope.agent.defaultProcessName=test-application-name') |
68 | 77 | expect(java_opts).to include('-Dintroscope.agent.hostName=test-application-uri-0') |
| 78 | + |
| 79 | + expect(java_opts).to include('-DagentManager.url.1=test-host-name:5001') |
69 | 80 | expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.host.DEFAULT=test-host-name') |
70 | | - expect(java_opts).to include('-DagentManager.url.1=http://test-host-name') |
| 81 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.port.DEFAULT=5001') |
| 82 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.socketfactory.DEFAULT=' \ |
| 83 | + 'com.wily.isengard.postofficehub.link.net.DefaultSocketFactory') |
| 84 | + |
71 | 85 | expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=$(expr "$VCAP_APPLICATION" : ' \ |
72 | 86 | '\'.*application_name[": ]*\\([A-Za-z0-9_-]*\\).*\')') |
73 | 87 | end |
| 88 | + end |
| 89 | + |
| 90 | + context do |
| 91 | + let(:credentials) { { 'url' => 'ssl://test-host-name:5443' } } |
74 | 92 |
|
75 | | - context do |
76 | | - let(:credentials) { super().merge 'agent-name' => 'another-test-agent-name' } |
| 93 | + it 'parses the url and sets host, port, and ssl socket factory' do |
| 94 | + component.release |
| 95 | + |
| 96 | + expect(java_opts).to include('-javaagent:$PWD/.java-buildpack/introscope_agent/Agent.jar') |
| 97 | + expect(java_opts).to include('-Dcom.wily.introscope.agentProfile=$PWD/.java-buildpack/introscope_agent/core' \ |
| 98 | + '/config/IntroscopeAgent.profile') |
| 99 | + expect(java_opts).to include('-Dintroscope.agent.defaultProcessName=test-application-name') |
| 100 | + expect(java_opts).to include('-Dintroscope.agent.hostName=test-application-uri-0') |
77 | 101 |
|
78 | | - it 'adds agent-name from credentials to JAVA_OPTS if specified' do |
79 | | - component.release |
| 102 | + expect(java_opts).to include('-DagentManager.url.1=ssl://test-host-name:5443') |
| 103 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.host.DEFAULT=test-host-name') |
| 104 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.port.DEFAULT=5443') |
| 105 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.socketfactory.DEFAULT=' \ |
| 106 | + 'com.wily.isengard.postofficehub.link.net.SSLSocketFactory') |
80 | 107 |
|
81 | | - expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=another-test-agent-name') |
82 | | - end |
| 108 | + expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=$(expr "$VCAP_APPLICATION" : ' \ |
| 109 | + '\'.*application_name[": ]*\\([A-Za-z0-9_-]*\\).*\')') |
83 | 110 | end |
| 111 | + end |
84 | 112 |
|
85 | | - context do |
86 | | - let(:credentials) { super().merge 'port' => 'test-port' } |
| 113 | + context do |
| 114 | + let(:credentials) { { 'url' => 'http://test-host-name:8081' } } |
87 | 115 |
|
88 | | - it 'adds port from credentials to JAVA_OPTS if specified' do |
89 | | - component.release |
| 116 | + it 'parses the url and sets host, port, and http socket factory' do |
| 117 | + component.release |
90 | 118 |
|
91 | | - expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.port.DEFAULT=test-port') |
92 | | - expect(java_opts).to include('-DagentManager.url.1=http://test-host-name:test-port') |
93 | | - end |
| 119 | + expect(java_opts).to include('-javaagent:$PWD/.java-buildpack/introscope_agent/Agent.jar') |
| 120 | + expect(java_opts).to include('-Dcom.wily.introscope.agentProfile=$PWD/.java-buildpack/introscope_agent/core' \ |
| 121 | + '/config/IntroscopeAgent.profile') |
| 122 | + expect(java_opts).to include('-Dintroscope.agent.defaultProcessName=test-application-name') |
| 123 | + expect(java_opts).to include('-Dintroscope.agent.hostName=test-application-uri-0') |
| 124 | + |
| 125 | + expect(java_opts).to include('-DagentManager.url.1=http://test-host-name:8081') |
| 126 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.host.DEFAULT=test-host-name') |
| 127 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.port.DEFAULT=8081') |
| 128 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.socketfactory.DEFAULT=' \ |
| 129 | + 'com.wily.isengard.postofficehub.link.net.HttpTunnelingSocketFactory') |
| 130 | + |
| 131 | + expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=$(expr "$VCAP_APPLICATION" : ' \ |
| 132 | + '\'.*application_name[": ]*\\([A-Za-z0-9_-]*\\).*\')') |
94 | 133 | end |
| 134 | + end |
95 | 135 |
|
96 | | - context do |
97 | | - let(:credentials) { super().merge 'ssl' => 'true' } |
| 136 | + context do |
| 137 | + let(:credentials) { { 'url' => 'https://test-host-name:8444' } } |
98 | 138 |
|
99 | | - it 'adds ssl socket factory from credentials to JAVA_OPTS if specified' do |
100 | | - component.release |
| 139 | + it 'parses the url and sets host, port, and https socket factory' do |
| 140 | + component.release |
101 | 141 |
|
102 | | - expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.socketfactory.DEFAULT=' \ |
103 | | - 'com.wily.isengard.postofficehub.link.net.SSLSocketFactory') |
104 | | - expect(java_opts).to include('-DagentManager.url.1=https://test-host-name') |
105 | | - end |
| 142 | + expect(java_opts).to include('-javaagent:$PWD/.java-buildpack/introscope_agent/Agent.jar') |
| 143 | + expect(java_opts).to include('-Dcom.wily.introscope.agentProfile=$PWD/.java-buildpack/introscope_agent/core' \ |
| 144 | + '/config/IntroscopeAgent.profile') |
| 145 | + expect(java_opts).to include('-Dintroscope.agent.defaultProcessName=test-application-name') |
| 146 | + expect(java_opts).to include('-Dintroscope.agent.hostName=test-application-uri-0') |
| 147 | + |
| 148 | + expect(java_opts).to include('-DagentManager.url.1=https://test-host-name:8444') |
| 149 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.host.DEFAULT=test-host-name') |
| 150 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.port.DEFAULT=8444') |
| 151 | + expect(java_opts).to include('-Dintroscope.agent.enterprisemanager.transport.tcp.socketfactory.DEFAULT=' \ |
| 152 | + 'com.wily.isengard.postofficehub.link.net.HttpsTunnelingSocketFactory') |
| 153 | + |
| 154 | + expect(java_opts).to include('-Dcom.wily.introscope.agent.agentName=$(expr "$VCAP_APPLICATION" : ' \ |
| 155 | + '\'.*application_name[": ]*\\([A-Za-z0-9_-]*\\).*\')') |
106 | 156 | end |
107 | 157 | end |
108 | | - |
109 | 158 | end |
110 | | - |
111 | 159 | end |
0 commit comments