assertTrue("The node should be of type CityData", object instanceof CityData); CityData node = (CityData)object; assertEquals("6", node.getId()); assertEquals(data.source, node.getUri().getSource()); assertNull(node.getLocale()); assertEquals(NodeType.CITY, node.getNodeType()); assertEquals("Münster", node.getName()); assertEquals(data.state, node.getState()); assertEquals(data.country, node.getCountry()); compareCoordinates(node.getCoordinates()); assertEquals(new Double(3), node.getNorth()); assertEquals(new Double(4), node.getEast()); assertEquals(new Double(5), node.getSouth()); assertEquals(new Double(6), node.getWest()); assertNotNull(node.getFeatures()); assertEquals(0, node.getFeatures().size()); assertNotNull(node.getFields()); assertEquals(0, node.getFields().size()); assertNotNull(node.getNodes()); assertEquals(1, node.getNodes().size()); assertTrue(node.getNodes().containsKey(data.type)); NodesInfo nodes = (NodesInfo)node.getNodes().get(data.type); assertNotNull(nodes); assertEquals(data.type, nodes.getType()); assertEquals(1, nodes.getNodes().size()); compareCustom(nodes.getNodes().get(0)); assertEquals(data.start1, node.getCreated()); assertEquals(data.end1, node.getModified()); assertEquals(new Integer(2), node.getVersion());
state.setVersion(2); city.setId("6"); city.setSource(source); city.setName("Münster"); city.setCountry(country); city.setState(state); city.setCoordinates(coordinates); city.setNorth(3.); city.setEast(4.); city.setSouth(5.); city.setWest(6.); city.setCreated(start1); city.setModified(end1); city.setVersion(2); list.add(custom); nodes.setNodes(list); city.getNodes().put(type, nodes); countries.put(country.getId(), country); states.put(state.getId(), state); cities.put(city.getId(), city); districts.put(district.getId(), district); places.put(place.getId(), place);
city1.setId("7"); city1.setName("Münster"); city2.setId("8"); city2.setName("STADT"); names.put(state1.getName(), state1); names.put(state2.getName(), state2); names.put(city1.getName(), city1); names.put(city2.getName(), city2); names.put(district1.getName(), district1); names.put(district2.getName(), district2);
@XmlElement(name = "CITY") public String getCity() { if (venue != null) { AddressInfo address = venue.getAddress(); if (address != null && address.getStreet() != null) return address.getCity(); } CityData city = place.getCity(); return city == null ? null : city.getName(); }
@Override public Stream<NodeData> prepare(CityData node) { LOG.warn("ignoring {} {}", node.getNodeType(), node); return Stream.empty(); }
@Before public void prepare() { Storage.openStage(nodeRepository, nodeService, config, nodeHandler, null, null); try { country.setSource(source); nodeRepository.store(country); state.setSource(source); nodeRepository.store(state); city.setSource(source); nodeRepository.store(city); district.setSource(source); nodeRepository.store(district); region.setSource(source); nodeRepository.store(region); category.setSource(source); nodeRepository.store(category); media.setSource(source); nodeRepository.store(media); recordingNodeRepository.clear(); } finally { Storage.closeStage(); } }
@Override public Stream<NodeData> find(NodeType type, GeoPlaceData place, String name) { switch (type) { case STATE: if (name.equals(data.state.getName())) return Arrays.asList((NodeData)data.state).stream(); else return new LinkedList<NodeData>().stream(); case CITY: if (name.equals(data.city.getName())) return Arrays.asList((NodeData)data.city).stream(); else return new LinkedList<NodeData>().stream(); case DISTRICT: if (name.equals(data.district.getName())) return Arrays.asList((NodeData)data.district).stream(); else return new LinkedList<NodeData>().stream(); case REGION: if (name.equals(data.region.getName())) return Arrays.asList((NodeData)data.region).stream(); else return new LinkedList<NodeData>().stream(); default: throw new UnsupportedOperationException("Not implemented!"); } }
assertEquals(1, node.getCities().size()); CityData city = (CityData)node.getCities().get(0); assertEquals("6", city.getId()); assertEquals(data.source, city.getUri().getSource()); assertNull(city.getLocale()); assertEquals(NodeType.CITY, city.getNodeType()); assertEquals("Münster", city.getName()); assertEquals(data.state, city.getState()); assertEquals(data.country, city.getCountry()); compareCoordinates(city.getCoordinates()); assertEquals(new Double(3), city.getNorth()); assertEquals(new Double(4), city.getEast()); assertEquals(new Double(5), city.getSouth()); assertEquals(new Double(6), city.getWest()); assertEquals(data.start1, city.getCreated()); assertEquals(data.end1, city.getModified()); assertEquals(new Integer(2), city.getVersion()); compareCoordinates(node.getCoordinates()); assertEquals(new Double(3), node.getNorth());
return new LinkedList<NodeData>().stream(); case CITY: if (name.equals(data.city.getName())) return Arrays.asList((NodeData)data.city).stream(); else
assertEquals(1, region.getCities().size()); CityData city = (CityData)region.getCities().get(0); assertEquals("6", city.getId()); assertEquals(data.source, city.getUri().getSource()); assertNull(city.getLocale()); assertEquals(NodeType.CITY, city.getNodeType()); assertEquals("Münster", city.getName()); assertEquals(data.state, city.getState()); assertEquals(data.country, city.getCountry()); compareCoordinates(city.getCoordinates()); assertEquals(new Double(3), city.getNorth()); assertEquals(new Double(4), city.getEast()); assertEquals(new Double(5), city.getSouth()); assertEquals(new Double(6), city.getWest()); assertEquals(data.start1, city.getCreated()); assertEquals(data.end1, city.getModified()); assertEquals(new Integer(2), city.getVersion()); compareCoordinates(region.getCoordinates()); assertEquals(new Double(3), region.getNorth());