BundleEventData { public static BundleEventData from(CompositeData compositeData) throws IllegalArgumentException { BundleEventData eventData = new BundleEventData(); if (compositeData == null) { throw new IllegalArgumentException("Argument compositeData cannot be null"); } if (!compositeData.getCompositeType().equals(BUNDLE_EVENT_TYPE)) { throw new IllegalArgumentException("Invalid CompositeType [" + compositeData.getCompositeType() + "]"); } eventData.bundleId = (Long) compositeData.get(IDENTIFIER); eventData.bundleSymbolicName = (String) compositeData.get(SYMBOLIC_NAME); eventData.eventType = (Integer) compositeData.get(EVENT); eventData.location = (String) compositeData.get(LOCATION); return eventData; } private  BundleEventData();  BundleEventData(BundleEvent bundleEvent); CompositeData toCompositeData(); static BundleEventData from(CompositeData compositeData); long getBundleId(); String getLocation(); String getBundleSymbolicName(); int getEventType();  }
@Test public void testFrom() throws Exception { Map<String, Object> items = new HashMap<String, Object>(); items.put(IDENTIFIER, new Long(7)); items.put(SYMBOLIC_NAME, "t"); items.put(LOCATION, "l"); items.put(EVENT, BundleEvent.RESOLVED); CompositeData compositeData = new CompositeDataSupport(BUNDLE_EVENT_TYPE, items); BundleEventData event = BundleEventData.from(compositeData); assertEquals(7, event.getBundleId()); assertEquals("t", event.getBundleSymbolicName()); assertEquals("l", event.getLocation()); assertEquals(BundleEvent.RESOLVED, event.getEventType()); }