[jbosstools-issues] [JBoss JIRA] (JBIDE-12321) handle IApplication#getEmbeddedCartridges correctly with changes to protocol 1.2

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Tue May 7 09:03:53 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-12321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772683#comment-12772683 ] 

Andre Dietisheim commented on JBIDE-12321:
------------------------------------------

There are also unit- and integration tests that assert that the application type is not reported in ApplicationResource#getEmbeddedCartridges:

https://github.com/openshift/openshift-java-client/blob/master/src/test/java/com/openshift/internal/client/ApplicationResourceTest.java#L290
{code:title=ApplicationResourceTest} 
@Test
	public void shouldListExistingCartridges() throws Throwable {
		// pre-conditions
		when(mockClient.get(urlEndsWith("/domains/foobarz/applications")))
				.thenReturn(GET_DOMAINS_FOOBARZ_APPLICATIONS.getContentAsString());
		when(mockClient.get(urlEndsWith("/domains/foobarz/applications/springeap6")))
				.thenReturn(GET_DOMAINS_FOOBARZ_APPLICATIONS_SPRINGEAP6.getContentAsString());
		when(mockClient.get(urlEndsWith("/domains/foobarz/applications/springeap6/cartridges")))
				.thenReturn(GET_DOMAINS_FOOBARZ_APPLICATIONS_SPRINGEAP6_CARTRIDGES_2EMBEDDED.getContentAsString());
		final IApplication app = domain.getApplicationByName("springeap6");
		// operation
		final List<IEmbeddedCartridge> embeddedCartridges = app.getEmbeddedCartridges();
		// verifications
		assertThat(embeddedCartridges).hasSize(2);
	}
{code}

and 

{code:title=ApplicationResourceIntegrationTest}
	@Test
	public void shouldNotContainTypeInEmbeddedCartridges() throws SocketTimeoutException, OpenShiftException {
		// pre-conditions
		final IStandaloneCartridge jbossAs = LatestVersionOf.jbossAs().get(user);
		assertThat(jbossAs).isNotNull();
		IApplication application = ApplicationTestUtils.ensureHasExactly1Application(jbossAs, domain);

		// operation
		List<IEmbeddedCartridge> embeddedCartridges = application.getEmbeddedCartridges();
		// verification
		assertThat(embeddedCartridges).doesNotSatisfy(new Condition<List<?>>() {
			
			@Override
			public boolean matches(List<?> values) {
				for(Object value : values) {
					if (!(value instanceof ICartridge)) {
						continue;
					}
					if (jbossAs.getName().equals(((ICartridge)value).getName())) {
						return true;
					};
				}
				return false;
			}
		});
	}
{code}
                
> handle IApplication#getEmbeddedCartridges correctly with changes to protocol 1.2
> --------------------------------------------------------------------------------
>
>                 Key: JBIDE-12321
>                 URL: https://issues.jboss.org/browse/JBIDE-12321
>             Project: Tools (JBoss Tools)
>          Issue Type: Sub-task
>          Components: openshift
>    Affects Versions: 4.0.0.Alpha1
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>             Fix For: 4.1.0.Beta1
>
>         Attachments: app-type-listed-as-embedded.png, type-not-reported-as-embeddedcartridge.png
>
>
> In 1.1 the cartridges that you get reported when listing them on a application changed (IApplication#getEmbeddedCartridges):
> * 1.0:
> would report the embedded cartridges only
> * 1.1:
> would report the embedded cartridges and the application type (cartridge)
> !app-type-listed-as-embedded.png!
> see here: https://github.com/openshift/crankcase/pull/224
> The error that this caused was discussed here: 
> https://bugzilla.redhat.com/show_bug.cgi?id=838611
> OpenShift pushed the discussed change (application-type reported as embedded cartridge) to protocol v1.1 and fixed the issue on the server-side. Our client, that currently requests protocol v1.0 has no issue since the fix. We have to make sure we support protocol 1.1 and are able to handle this correctly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list