@Override
    public void persistInstance(final InstanceEntity instance) {
        final InstanceRegisterRequest req = new InstanceRegisterRequest();
        req.setInstanceId(buildInstanceNodeName(instance));
        req.setWeight(1);
        req.setHost(instance.getHost());
        req.setPort(instance.getPort());
        req.setService(instance.getAppName());
        req.setNamespace(namespace);
        try {
            providerAPI.registerInstance(req);
        } catch (PolarisException e) {
            throw new ShenyuException(e);
        }
    }
@Test
    public void testPersistInstance() {
        InstanceEntity data = InstanceEntity.builder()
                                  .appName("shenyu-test")
                                  .host("shenyu-host")
                                  .port(9195)
                                  .build();

        final String key = "shenyu-test";
        repository.persistInstance(data);
        assertTrue(storage.containsKey(key));

        final Instance instance = storage.get(key);
        assertEquals(data.getHost(), instance.getHost());
        assertEquals(data.getPort(), instance.getPort());
        assertEquals(data.getAppName(), instance.getService());
        repository.close();
    }