public void replayCreateResource(Resource resource) throws DdlException {
        if (resource.needMappingCatalog()) {
            String type = resource.getType().name().toLowerCase(Locale.ROOT);
            String catalogName = getResourceMappingCatalogName(resource.getName(), type);

            if (nameToResource.containsKey(resource.name)) {
                DropCatalogStmt dropCatalogStmt = new DropCatalogStmt(catalogName);
                GlobalStateMgr.getCurrentState().getCatalogMgr().dropCatalog(dropCatalogStmt);
            }

            Map<String, String> properties = Maps.newHashMap(resource.getProperties());
            properties.put("type", type);
            properties.put(HIVE_METASTORE_URIS, resource.getHiveMetastoreURIs());
            GlobalStateMgr.getCurrentState().getCatalogMgr().createCatalog(type, catalogName, "mapping catalog", properties);
        }

        this.writeLock();
        try {
            nameToResource.put(resource.getName(), resource);
        } finally {
            this.writeUnLock();
        }

        LOG.info("replay create/alter resource log success. resource name: {}", resource.getName());
    }
@Test
    public void testReplayCreateResource(@Injectable EditLog editLog, @Mocked GlobalStateMgr globalStateMgr)
            throws UserException {
        ResourceMgr mgr = new ResourceMgr();
        type = "hive";
        name = "hive0";

        addHiveResource(mgr, editLog, globalStateMgr);
        Resource hiveRes = new HiveResource(name);
        Map<String, String> properties = new HashMap<>();
        String newUris = "thrift://10.10.44.xxx:9083";
        properties.put("hive.metastore.uris", newUris);
        hiveRes.setProperties(properties);
        mgr.replayCreateResource(hiveRes);
        Assert.assertNotNull(mgr.getResource(name));
    }