### Question:
UpgradeHandler_V8 implements UpgradeHandler { @Override public void processDataMapDom(UpgradeUnit upgradeUnit) { Element dataMap = upgradeUnit.getDocument().getDocumentElement(); dataMap.setAttribute("xmlns","http: dataMap.setAttribute("xsi:schemaLocation", "http: "https: dataMap.setAttribute("project-version", getVersion()); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList queryNodes; try { queryNodes = (NodeList) xpath.evaluate("/data-map/query", upgradeUnit.getDocument(), XPathConstants.NODESET); } catch (Exception ex) { return; } for (int j = 0; j < queryNodes.getLength(); j++) { Element queryElement = (Element) queryNodes.item(j); String factory = queryElement.getAttribute("factory"); if(factory == null || factory.isEmpty()) { continue; } String queryType; switch (factory) { case "org.apache.cayenne.map.SelectQueryBuilder": queryType = QueryDescriptor.SELECT_QUERY; break; case "org.apache.cayenne.map.SQLTemplateBuilder": queryType = QueryDescriptor.SQL_TEMPLATE; break; case "org.apache.cayenne.map.EjbqlBuilder": queryType = QueryDescriptor.EJBQL_QUERY; break; case "org.apache.cayenne.map.ProcedureQueryBuilder": queryType = QueryDescriptor.PROCEDURE_QUERY; break; default: throw new ConfigurationException("Unknown query factory: " + factory); } queryElement.setAttribute("type", queryType); queryElement.removeAttribute("factory"); } }  @Override String getVersion(); @Override void processProjectDom(UpgradeUnit upgradeUnit); @Override void processDataMapDom(UpgradeUnit upgradeUnit);  }### Answer:
@Test public void testDataMapDomUpgrade() throws Exception { Document document = processDataMapDom("test-map-v7.map.xml"); Element root = document.getDocumentElement(); assertEquals("8", root.getAttribute("project-version")); assertEquals("http: assertEquals(2, root.getElementsByTagName("db-attribute").getLength()); NodeList nodeList = root.getElementsByTagName("query"); for(int i=0; i<nodeList.getLength(); i++) { NamedNodeMap attributes = nodeList.item(i).getAttributes(); assertNull(attributes.getNamedItem("factory")); String type = attributes.getNamedItem("type").getNodeValue(); switch (attributes.getNamedItem("name").getNodeValue()) { case "EjbqlQueryTest": assertEquals("EJBQLQuery", type); break; case "SQLTemplateTest": assertEquals("SQLTemplate", type); break; case "SelectQueryTest": assertEquals("SelectQuery", type); break; case "ProcedureQueryTest": assertEquals("ProcedureQuery", type); break; } } }