@Override protected boolean checkActivation(Connector cmd, IronJacamar ijmd) { if (cmd != null) { Set<String> raMcfClasses = new HashSet<String>(); Set<String> raAoClasses = new HashSet<String>(); if (cmd.getVersion() == Version.V_10) { ResourceAdapter10 ra10 = (ResourceAdapter10) cmd.getResourceadapter(); raMcfClasses.add(ra10.getManagedConnectionFactoryClass().getValue()); } else { ResourceAdapter1516 ra = (ResourceAdapter1516) cmd.getResourceadapter(); if (ra != null && ra.getOutboundResourceadapter() != null && ra.getOutboundResourceadapter().getConnectionDefinitions() != null) { List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions(); if (cdMetas.size() > 0) { for (ConnectionDefinition cdMeta : cdMetas) { raMcfClasses.add(cdMeta.getManagedConnectionFactoryClass().getValue()); } } } if (ra != null && ra.getAdminObjects() != null) { List<AdminObject> aoMetas = ra.getAdminObjects(); if (aoMetas.size() > 0) { for (AdminObject aoMeta : aoMetas) { raAoClasses.add(aoMeta.getAdminobjectClass().getValue()); } } } // Pure inflow if (raMcfClasses.size() == 0 && raAoClasses.size() == 0) return true; } if (ijmd != null) { if (ijmd.getConnectionDefinitions() != null) { for (org.jboss.jca.common.api.metadata.common.CommonConnDef def : ijmd.getConnectionDefinitions()) { String clz = def.getClassName(); if (raMcfClasses.contains(clz)) return true; } } if (ijmd.getAdminObjects() != null) { for (org.jboss.jca.common.api.metadata.common.CommonAdminObject def : ijmd.getAdminObjects()) { String clz = def.getClassName(); if (raAoClasses.contains(clz)) return true; } } } } return false; }
/** * checks connector 1.5 * * @param result of parsing */ @Override public void checkMetadata(JCAMetadata result) { Connector connector = (Connector) result; assertTrue(connector instanceof Connector15Impl); assertEquals(connector.getVersion(), Version.V_15); Connector15Impl con = (Connector15Impl) connector; assertEquals("ID001", con.getId()); assertEquals( con.getDescriptions(), createDescriptions( new LocalizedXsdString("something", "ID001A"), new LocalizedXsdString("something", "ID001B", "en"), new LocalizedXsdString("something", "ID001C", "de"))); checkLocalizedXsdString( con.getDescriptions().get(1), "something", "ID001B", "description", "en"); assertEquals( con.getDisplayNames(), createDisplayNames( new LocalizedXsdString("something", null), new LocalizedXsdString("something", null, "de"))); List<Icon> icons = con.getIcons(); assertEquals(2, icons.size()); Icon icon = icons.get(0); assertEquals("ID001D", icon.getId()); assertEquals(null, icon.getLang()); checkXsdString(icon.getSmallIcon(), "small.gif", "ID001F", "small-icon"); checkXsdString(icon.getLargeIcon(), "large.gif", "ID001E", "large-icon"); icon = icons.get(1); assertEquals("ID001G", icon.getId()); assertEquals("de", icon.getLang()); assertEquals(icon.getSmallIcon(), null); assertEquals(icon.getLargeIcon(), null); checkXsdString(con.getVendorName(), "something", "ID002", "vendor-name"); checkXsdString(con.getResourceadapterVersion(), "5", "ID006A", "resourceadapter-version"); checkXsdString(con.getEisType(), "something", "ID004", "eis-type"); LicenseType license = con.getLicense(); assertEquals("ID003", license.getId()); assertEquals( license.getDescriptions(), createDescriptions( new LocalizedXsdString("something", "ID003A"), new LocalizedXsdString("something", null, "de"))); assertFalse(license.isLicenseRequired()); assertEquals("ID003B", license.getLicReqId()); ResourceAdapter rai = con.getResourceadapter(); assertTrue(rai instanceof ResourceAdapter1516Impl); ResourceAdapter1516Impl ra = (ResourceAdapter1516Impl) rai; assertEquals("ID005", ra.getId()); assertEquals(ra.getResourceadapterClass(), "Class1"); List<? extends ConfigProperty> cps = ra.getConfigProperties(); assertEquals(2, cps.size()); checkConfigProperty( cps.get(0), "ID007", "ID006", "aaa", null, "java.lang.Short", null, "12", new LocalizedXsdString("something", "ID007B", "en"), new LocalizedXsdString("something", "ID007C", "de")); checkConfigProperty( cps.get(1), "ID009", null, "bbb", null, "java.lang.Integer", null, "35674", new LocalizedXsdString("something", "ID009B", "en"), new LocalizedXsdString("something", "ID009C", "de")); OutboundResourceAdapterImpl out = (OutboundResourceAdapterImpl) ra.getOutboundResourceadapter(); assertEquals("ID011", out.getId()); List<ConnectionDefinition> cds = out.getConnectionDefinitions(); assertEquals(2, cds.size()); ConnectionDefinition cd = cds.get(0); assertEquals("ID013", cd.getId()); checkXsdString( cd.getManagedConnectionFactoryClass(), "Class2", "ID013A", "managedconnectionfactory-class"); checkXsdString( cd.getConnectionFactoryInterface(), "Interface1", "ID017A", "connectionfactory-interface"); checkXsdString( cd.getConnectionFactoryImplClass(), "Class3", "ID017B", "connectionfactory-impl-class"); checkXsdString(cd.getConnectionInterface(), "Interface2", "ID017C", "connection-interface"); checkXsdString(cd.getConnectionImplClass(), "Class4", "ID017D", "connection-impl-class"); cps = cd.getConfigProperties(); assertEquals(2, cps.size()); checkConfigProperty( cps.get(0), "ID015", null, "ccc", null, "java.lang.Character", null, "c", new LocalizedXsdString("something", null), new LocalizedXsdString("something", "ID014")); checkConfigProperty( cps.get(1), "ID016", null, "dddd", null, "java.lang.Byte", null, "24", new LocalizedXsdString("12345", null, "ru"), new LocalizedXsdString("", null)); cd = cds.get(1); assertEquals("ID019", cd.getId()); checkXsdString( cd.getManagedConnectionFactoryClass(), "", null, "managedconnectionfactory-class"); checkXsdString(cd.getConnectionFactoryInterface(), "", null, "connectionfactory-interface"); checkXsdString(cd.getConnectionFactoryImplClass(), "", null, "connectionfactory-impl-class"); checkXsdString(cd.getConnectionInterface(), "", null, "connection-interface"); checkXsdString(cd.getConnectionImplClass(), "", null, "connection-impl-class"); cps = cd.getConfigProperties(); assertEquals(2, cps.size()); checkConfigProperty( cps.get(0), "ID021", null, "", null, "", null, "", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); checkConfigProperty( cps.get(1), "ID023", null, "", null, "", null, "", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); assertEquals(out.getTransactionSupport(), TransactionSupportEnum.LocalTransaction); assertEquals("ID024", out.getTransactionSupportId()); List<AuthenticationMechanism> ams = out.getAuthenticationMechanisms(); assertEquals(2, ams.size()); checkAuthenticationMechanism( ams.get(0), "ID025", "ID025A", "type", "ID025B", CredentialInterfaceEnum.PasswordCredential, new LocalizedXsdString("", null), new LocalizedXsdString("a", null, "en")); checkAuthenticationMechanism( ams.get(1), "ID027", null, "", null, CredentialInterfaceEnum.GenericCredential, new LocalizedXsdString("", null), new LocalizedXsdString("", null)); assertEquals(false, out.getReauthenticationSupport()); assertEquals("ID028", out.getReauthenticationSupportId()); InboundResourceAdapter in = ra.getInboundResourceadapter(); assertEquals("ID029", in.getId()); Messageadapter ma = in.getMessageadapter(); assertEquals("ID031", ma.getId()); List<MessageListener> mls = ma.getMessagelisteners(); assertEquals(2, mls.size()); MessageListener ml = mls.get(0); assertEquals("ID033", ml.getId()); checkXsdString(ml.getMessagelistenerType(), "type", "ID034", "messagelistener-type"); Activationspec15Impl as = (Activationspec15Impl) ml.getActivationspec(); assertEquals("ID035", as.getId()); checkXsdString(as.getActivationspecClass(), "class6", null, "activationspec-class"); List<RequiredConfigProperty> rcps = as.getRequiredConfigProperties(); assertEquals(2, rcps.size()); checkRequiredConfigProperty( rcps.get(0), "ID035A", "ID035D", "bbb", new LocalizedXsdString("something", "ID035B", "en"), new LocalizedXsdString("something", "ID035C", "de")); checkRequiredConfigProperty( rcps.get(1), null, null, "ccc", new LocalizedXsdString("something", null), new LocalizedXsdString("", null)); ml = mls.get(1); assertEquals("ID037", ml.getId()); checkXsdString(ml.getMessagelistenerType(), "", null, "messagelistener-type"); as = (Activationspec15Impl) ml.getActivationspec(); assertEquals("ID039", as.getId()); checkXsdString(as.getActivationspecClass(), "", null, "activationspec-class"); rcps = as.getRequiredConfigProperties(); assertEquals(1, rcps.size()); assertEquals(null, rcps.get(0).getId()); assertEquals(createDescriptions(null), rcps.get(0).getDescriptions()); assertTrue(XsdString.isNull(rcps.get(0).getConfigPropertyName())); List<AdminObject> aos = ra.getAdminObjects(); assertEquals(2, aos.size()); AdminObject ao = aos.get(0); assertEquals("ID041", ao.getId()); checkXsdString(ao.getAdminobjectInterface(), "Interface5", "ID041A", "adminobject-interface"); checkXsdString(ao.getAdminobjectClass(), "class7", "ID042", "adminobject-class"); cps = ao.getConfigProperties(); assertEquals(2, cps.size()); checkConfigProperty( cps.get(0), "ID043", null, "eee", null, "java.lang.Double", null, "3.14", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); checkConfigProperty( cps.get(1), "ID045", null, "sss", null, "java.lang.Float", null, null, new LocalizedXsdString("", null), new LocalizedXsdString("", null)); ao = aos.get(1); assertEquals("ID047", ao.getId()); checkXsdString(ao.getAdminobjectInterface(), "", null, "adminobject-interface"); checkXsdString(ao.getAdminobjectClass(), "", null, "adminobject-class"); cps = ao.getConfigProperties(); assertEquals(2, cps.size()); checkConfigProperty( cps.get(0), "ID049", null, "", null, "", null, "", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); checkConfigProperty( cps.get(1), "ID051", null, "", null, "", null, "", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); List<SecurityPermission> sps = ra.getSecurityPermissions(); assertEquals(2, sps.size()); checkSecurityPermission( sps.get(0), "ID053", "ID054", "spec1", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); checkSecurityPermission( sps.get(1), "ID055", null, "", new LocalizedXsdString("", null), new LocalizedXsdString("", null)); }