public void services(Map<String, Object> context) throws IOException

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

{
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();
        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");
        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


{
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();
        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");
        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders()


        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {

        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");
        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();

        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();
        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + "

        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();
        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");
        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());
            if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }
        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


if (parameter != null) {
                String dubboversion = parameter.get("dubbo");
                String app = parameter.get("application");
                if (versions.get(dubboversion) == null) {
                    Set<String> apps = new HashSet<String>();
                    versions.put(dubboversion, apps);
                }
                versions.get(dubboversion).add(app);
            }

package com.alibaba.dubbo.governance.web.sysinfo.module.screen;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.governance.service.ConsumerService;
import com.alibaba.dubbo.governance.service.ProviderService;
import com.alibaba.dubbo.governance.web.common.module.screen.Restful;
import com.alibaba.dubbo.registry.common.domain.Consumer;
import com.alibaba.dubbo.registry.common.domain.Provider;

/**
 * @author tony.chenl
 */
public class Dump extends Restful {

    @Autowired
    ProviderService providerDAO;

    @Autowired
    ConsumerService consumerDAO;

    @Autowired
    HttpServletResponse response;

    public void noProviders(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = getNoProviders();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services don't have provider");
        for (String noProvider : sortedService) {
            writer.println(noProvider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void services(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<String> sortedService = providerDAO.findServices();
        Collections.sort(sortedService);
        writer.println(sortedService.size() + " services");
        for (String service : sortedService) {
            writer.println(service + (providerDAO.findByService(service).size()));
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void providers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<String> sortedProviders = new ArrayList<String>();
        for (Provider provider : providers) {
            sortedProviders.add(provider.getUrl() + " " + provider.getService());
        }
        Collections.sort(sortedProviders);
        writer.println(sortedProviders.size() + " provider instance");
        for (String provider : sortedProviders) {
            writer.println(provider);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void consumers(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Consumer> consumers = consumerDAO.findAll();
        List<String> sortedConsumerss = new ArrayList<String>();
        for (Consumer consumer : consumers) {
            sortedConsumerss.add(consumer.getAddress() + " " + consumer.getService());
        }
        Collections.sort(sortedConsumerss);
        writer.println(sortedConsumerss.size() + " consumer instance");
        for (String consumer : sortedConsumerss) {
            writer.println(consumer);
        }
        writer.flush();
        response.setContentType("text/plain");
    }

    public void versions(Map<String, Object> context) throws IOException {
        PrintWriter writer = response.getWriter();
        List<Provider> providers = providerDAO.findAll();
        List<Consumer> consumers = consumerDAO.findAll();
        Set<String> parametersSet = new HashSet<String>();
        Map<String, Set<String>> versions = new HashMap<String, Set<String>>();
        for (Provider provider : providers) {
            parametersSet.add(provider.getParameters());
        }
        for (Consumer consumer : consumers) {
            parametersSet.add(consumer.getParameters());
        }
        Iterator<String> temp = parametersSet.iterator();
        while (temp.hasNext()) {
            Map<String, String> parameter = StringUtils.parseQueryString(temp.next());

        }
        for (String version : versions.keySet()) {
            writer.println("dubbo version: " + version);
            writer.println(StringUtils.join(versions.get(version), "\n"));
            writer.println("\n");
        }
        context.put("versions", versions);
        writer.flush();
        response.setContentType("text/plain");
    }

    private List<String> getNoProviders() {
        List<String> providerServices = providerDAO.findServices();
        List<String> consumerServices = consumerDAO.findServices();
        List<String> noProviderServices = new ArrayList<String>();
        if (consumerServices != null) {
            noProviderServices.addAll(consumerServices);
            noProviderServices.removeAll(providerServices);
        }
        return noProviderServices;
    }
}


@OnClick(R.id.button_delete)
    public void onClickDelete()

package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView);
        fillViews();
        return convertView;
    }

    private void fillViews() {
        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }
    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

{
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView);
        fillViews();
        return convertView;
    }

    private void fillViews() {
        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }
    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet)

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView);
        fillViews();
        return convertView;
    }

    private void fillViews() {

        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }
    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }

    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView);
        fillViews();
        return convertView;
    }

    private void fillViews() {
        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView)

        fillViews();
        return convertView;
    }

    private void fillViews() {
        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());
            if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }
        }
    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


if (wallet.getMultisigWallet().getDeployStatus() > 2) {
                buttonDelete.setVisibility(View.GONE);
            }

package io.multy.ui.fragments;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.TextInputEditText;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import io.multy.R;
import io.multy.model.entities.wallet.Wallet;
import io.multy.ui.activities.CreateMultiSigActivity;

public class MultisigSettingsFragment extends BaseFragment {

    @BindView(R.id.text_signs)
    TextView textSigngs;

    @BindView(R.id.edit_name)
    TextInputEditText editName;

    @BindView(R.id.image_wallet)
    ImageView imageWallet;

    @BindView(R.id.text_wallet_name)
    TextView textWalletName;

    @BindView(R.id.text_wallet_address)
    TextView textWalletAddress;

    @BindView(R.id.button_delete)
    View buttonDelete;

    private Wallet wallet;

    private Wallet connectedWallet;

    public static MultisigSettingsFragment newInstance(Wallet wallet, Wallet connectedWallet) {
        MultisigSettingsFragment fragment = new MultisigSettingsFragment();
        fragment.setWallet(wallet);
        fragment.setConnectedWallet(connectedWallet);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View convertView = inflater.inflate(R.layout.fragment_multisig_settings, container, false);
        ButterKnife.bind(this, convertView);
        fillViews();
        return convertView;
    }

    private void fillViews() {
        if (wallet != null && wallet.isValid() && connectedWallet != null && connectedWallet.isValid()) {
            editName.setText(wallet.getWalletName());
            textWalletAddress.setText(connectedWallet.getActiveAddress().getAddress());
            textWalletName.setText(connectedWallet.getWalletName());
            imageWallet.setImageResource(connectedWallet.getIconResourceId());
            textSigngs.setText(wallet.getMultisigWallet().getConfirmations() + " / " + wallet.getMultisigWallet().getOwnersCount());

        }
    }

    @OnClick(R.id.button_save)
    public void onClickSave() {
        hideFragment();
    }

    @OnClick(R.id.button_delete)
    public void onClickDelete() {
        showDeletePrompt();
    }

    public void showDeletePrompt() {
        new AlertDialog.Builder(getActivity()).setMessage(R.string.delete_confirm).setPositiveButton(R.string.yes, (dialog, which) -> {
            ((CreateMultiSigActivity) getActivity()).removeWallet();
            dialog.cancel();
        }).setNegativeButton(R.string.no, (dialog, which) -> {
            dialog.cancel();
            hideFragment();
        }).show();
    }

    private void hideFragment() {
        getActivity().getSupportFragmentManager().beginTransaction().remove(this).commit();
    }

    public void setWallet(Wallet wallet) {
        this.wallet = wallet;
    }

    public void setConnectedWallet(Wallet connectedWallet) {
        this.connectedWallet = connectedWallet;
    }

    @OnClick(R.id.button_cancel)
    void onClickCancel(View view) {
        if (getActivity() != null) {
            view.setEnabled(false);
            getActivity().onBackPressed();
        }
    }
}


package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;
        return id == tracker.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

{
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;
        return id == tracker.id;
    }

    @Override
    public int hashCode()

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


        if (this == o)
            return true;

package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {

        if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;
        return id == tracker.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;

package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;

        return id == tracker.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


package net.kollnig.missioncontrol.data;

import androidx.annotation.NonNull;

public class StaticTracker implements Comparable<StaticTracker> {

    private final String name;

    private final String web;

    private final int id;

    private final String sign;

    public StaticTracker(@NonNull String name, String web, Integer id, String sign) {
        name = name.replaceAll("[°²?µ]", "");
        this.name = name;
        this.web = web;
        this.id = id;
        this.sign = sign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        StaticTracker tracker = (StaticTracker) o;
        return id == tracker.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web

    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


if (o == null || getClass() != o.getClass())
            return false;

        StaticTracker tracker = (StaticTracker) o;
        return id == tracker.id;
    }

    @Override
    public int hashCode() {
        return id;
    }

    @Override
    public String toString() {
        return name;
    }

    public String getName() {
        return name;
    }

    public String getWeb() {
        return web;
    }

    public Integer getId() {
        return id;
    }

    public String getSign() {
        return sign;
    }

    @Override
    public int compareTo(StaticTracker t) {
        return name.compareTo(t.name);
    }
}


@Override
    public void initialize(ExtensionContext context)

/*
 * JBoss, Home of Professional Open Source.
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 */
package org.wildfly.extension.clustering.web;

import java.util.EnumSet;
import org.jboss.as.clustering.controller.Schema;
import org.jboss.as.clustering.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.ExtensionContext;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.kohsuke.MetaInfServices;

/**
 * @author Paul Ferraro
 */
@MetaInfServices(Extension.class)
public class DistributableWebExtension implements Extension {

    static final String SUBSYSTEM_NAME = "distributable-web";

    static final SubsystemResourceDescriptionResolver SUBSYSTEM_RESOLVER = new DistributableWebResourceDescriptionResolver();

{
        SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME, DistributableWebModel.CURRENT.getVersion());
        new DistributableWebResourceDefinition().register(registration);
        registration.registerXMLElementWriter(new DistributableWebXMLParser(DistributableWebSchema.CURRENT));
    }

    @Override
    public void initializeParsers(ExtensionParsingContext context) {
        for (Schema<DistributableWebSchema> schema : EnumSet.allOf(DistributableWebSchema.class)) {
            context.setSubsystemXmlMapping(SUBSYSTEM_NAME, schema.getNamespaceUri(), new DistributableWebXMLParser(schema));
        }
    }
}


{
        for (Schema<DistributableWebSchema> schema : EnumSet.allOf(DistributableWebSchema.class)) {
            context.setSubsystemXmlMapping(SUBSYSTEM_NAME, schema.getNamespaceUri(), new DistributableWebXMLParser(schema));
        }
    }

/*
 * JBoss, Home of Professional Open Source.
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 */
package org.wildfly.extension.clustering.web;

import java.util.EnumSet;
import org.jboss.as.clustering.controller.Schema;
import org.jboss.as.clustering.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.ExtensionContext;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.kohsuke.MetaInfServices;

/**
 * @author Paul Ferraro
 */
@MetaInfServices(Extension.class)
public class DistributableWebExtension implements Extension {

    static final String SUBSYSTEM_NAME = "distributable-web";

    static final SubsystemResourceDescriptionResolver SUBSYSTEM_RESOLVER = new DistributableWebResourceDescriptionResolver();

    @Override
    public void initialize(ExtensionContext context) {
        SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME, DistributableWebModel.CURRENT.getVersion());
        new DistributableWebResourceDefinition().register(registration);
        registration.registerXMLElementWriter(new DistributableWebXMLParser(DistributableWebSchema.CURRENT));
    }

    @Override
    public void initializeParsers(ExtensionParsingContext context)


/*
 * JBoss, Home of Professional Open Source.
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 */
package org.wildfly.extension.clustering.web;

import java.util.EnumSet;
import org.jboss.as.clustering.controller.Schema;
import org.jboss.as.clustering.controller.descriptions.SubsystemResourceDescriptionResolver;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.ExtensionContext;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.kohsuke.MetaInfServices;

/**
 * @author Paul Ferraro
 */
@MetaInfServices(Extension.class)
public class DistributableWebExtension implements Extension {

    static final String SUBSYSTEM_NAME = "distributable-web";

    static final SubsystemResourceDescriptionResolver SUBSYSTEM_RESOLVER = new DistributableWebResourceDescriptionResolver();

    @Override
    public void initialize(ExtensionContext context) {
        SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME, DistributableWebModel.CURRENT.getVersion());
        new DistributableWebResourceDefinition().register(registration);
        registration.registerXMLElementWriter(new DistributableWebXMLParser(Distributabl

    }

    @Override
    public void initializeParsers(ExtensionParsingContext context) {
        for (Schema<DistributableWebSchema> schema : EnumSet.allOf(DistributableWebSchema.class)) {
            context.setSubsystemXmlMapping(SUBSYSTEM_NAME, schema.getNamespaceUri(), new DistributableWebXMLParser(schema));
        }
    }
}


public static ModifyRiskSingleResultStatusResponse unmarshall(ModifyRiskSingleResultStatusResponse modifyRiskSingleResultStatusResponse, UnmarshallerContext _ctx)

package com.aliyuncs.sas.transform.v20181203;

import com.aliyuncs.sas.model.v20181203.ModifyRiskSingleResultStatusResponse;
import com.aliyuncs.transform.UnmarshallerContext;

public class ModifyRiskSingleResultStatusResponseUnmarshaller {

{
        modifyRiskSingleResultStatusResponse.setRequestId(_ctx.stringValue("ModifyRiskSingleResultStatusResponse.RequestId"));
        return modifyRiskSingleResultStatusResponse;
    }
}


{
        modifyRiskSingleResultStatusResponse.setRequestId(_ctx.stringValue("ModifyRiskSingleResultStatusResponse.RequestId"));
        return modifyRiskSingleResultStatusResponse;
    }

package com.aliyuncs.sas.transform.v20181203;

import com.aliyuncs.sas.model.v20181203.ModifyRiskSingleResultStatusResponse;
import com.aliyuncs.transform.UnmarshallerContext;

public class ModifyRiskSingleResultStatusResponseUnmarshaller {

    public static ModifyRiskSingleResultStatusResponse unmarshall(ModifyRiskSingleResultStatusResponse modifyRiskSingleResultStatusResponse, UnmarshallerContext _ctx)


package com.aliyuncs.sas.transform.v20181203;

import com.aliyuncs.sas.model.v20181203.ModifyRiskSingleResultStatusResponse;
import com.aliyuncs.transform.UnmarshallerContext;

public class ModifyRiskSingleResultStatusResponseUnmarshaller {

    public static ModifyRiskSingleResultStatusResponse unmarshall(ModifyRiskSingleResultStatusResponse modifyRiskSingleResultStatusResponse, UnmarshallerContext _ctx) {
        modifyRiskSingleResultStatusResponse.setRequestId(_ctx.stringValue("ModifyRiskSingleResultStatusResponse.RequestId"));
        return mo


@Test()
    public void testRefreshOnly() throws Exception

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */

{
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


{
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {

        assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}


assertEquals(m.intValue(), 1);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);

/*
 * All Rights Reserved.
 */
package com.unboundid.ldap.sdk.controls;

import java.util.HashSet;
import java.util.Set;
import org.testng.annotations.Test;
import com.unboundid.ldap.sdk.LDAPSDKTestCase;

/**
 * This class provides a set of test cases for the
 * {@code ContentSyncRequestMode} class.
 */
public final class ContentSyncRequestModeTestCase extends LDAPSDKTestCase {

    /**
     * Provides test coverage for the REFRESH_ONLY mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshOnly() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_ONLY;
        assertNotNull(m.name());
        assertNotNull(m.toString());

        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides test coverage for the REFRESH_AND_PERSIST mode.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testRefreshAndPersist() throws Exception {
        final ContentSyncRequestMode m = ContentSyncRequestMode.REFRESH_AND_PERSIST;
        assertNotNull(m.name());
        assertNotNull(m.toString());
        assertEquals(m.intValue(), 3);
        assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
        assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
        assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
        assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
    }

    /**
     * Provides general test coverage for the enum.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testGeneral() throws Exception {
        for (final ContentSyncRequestMode m : ContentSyncRequestMode.values()) {
            assertNotNull(m);
            assertNotNull(ContentSyncRequestMode.valueOf(m.intValue()));
            assertEquals(ContentSyncRequestMode.valueOf(m.intValue()), m);
            assertNotNull(m.name());
            assertNotNull(ContentSyncRequestMode.valueOf(m.name()));
            assertEquals(ContentSyncRequestMode.valueOf(m.name()), m);
        }
        try {
            ContentSyncRequestMode.valueOf("invalid");
            fail("Expected an exception for an invalid valueOf string");
        } catch (final Exception e) {
            // This was expected.
        }
        assertNull(ContentSyncRequestMode.valueOf(-1));
    }

    /**
     * Tests the {@code forName} method with automated tests based on the actual
     * name of the enum values.
     *
     * @throws  Exception  If an unexpected problem occurs.
     */
    @Test()
    public void testForNameAutomated() throws Exception {
        for (final ContentSyncRequestMode value : ContentSyncRequestMode.values()) {
            for (final String name : getNames(value.name())) {
                assertNotNull(ContentSyncRequestMode.forName(name));
                assertEquals(ContentSyncRequestMode.forName(name), value);
            }
        }
        assertNull(ContentSyncRequestMode.forName("some undefined name"));
    }

    /**
     * Retrieves a set of names for testing the {@code forName} method based on
     * the provided set of names.
     *
     * @param  baseNames  The base set of names to use to generate the full set of
     *                    names.  It must not be {@code null} or empty.
     *
     * @return  The full set of names to use for testing.
     */
    private static Set<String> getNames(final String... baseNames) {
        final HashSet<String> nameSet = new HashSet<>(10);
        for (final String name : baseNames) {
            nameSet.add(name);
            nameSet.add(name.toLowerCase());
            nameSet.add(name.toUpperCase());
            final String nameWithDashesInsteadOfUnderscores = name.replace('_', '-');
            nameSet.add(nameWithDashesInsteadOfUnderscores);
            nameSet.add(nameWithDashesInsteadOfUnderscores.toLowerCase());
            nameSet.add(nameWithDashesInsteadOfUnderscores.toUpperCase());
            final String nameWithUnderscoresInsteadOfDashes = name.replace('-', '_');
            nameSet.add(nameWithUnderscoresInsteadOfDashes);
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toLowerCase());
            nameSet.add(nameWithUnderscoresInsteadOfDashes.toUpperCase());
            final StringBuilder nameWithoutUnderscoresOrDashes = new StringBuilder();
            for (final char c : name.toCharArray()) {
                if ((c != '-') && (c != '_')) {
                    nameWithoutUnderscoresOrDashes.append(c);
                }
            }
            nameSet.add(nameWithoutUnderscoresOrDashes.toString());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toLowerCase());
            nameSet.add(nameWithoutUnderscoresOrDashes.toString().toUpperCase());
        }
        return nameSet;
    }
}