Search in sources :

Example 1 with IApiCatalog

use of io.apiman.manager.api.core.IApiCatalog in project apiman by apiman.

the class TestCdiFactory method provideApiCatalog.

@Produces
@ApplicationScoped
public static IApiCatalog provideApiCatalog(IPluginRegistry pluginRegistry) {
    return new IApiCatalog() {

        /**
         * @see io.apiman.manager.api.core.IApiCatalog#search(java.lang.String, java.lang.String)
         */
        @Override
        public List<AvailableApiBean> search(String keyword, String namespace) {
            List<AvailableApiBean> rval = new ArrayList<>();
            AvailableApiBean asb = new AvailableApiBean();
            asb.setName("Test API 1");
            asb.setDescription("The first test API.");
            asb.setEndpoint("http://api1.example.org/api");
            asb.setEndpointType(EndpointType.rest);
            rval.add(asb);
            asb = new AvailableApiBean();
            asb.setName("Test API 2");
            asb.setDescription("The second test API.");
            asb.setEndpoint("http://api2.example.org/api");
            asb.setEndpointType(EndpointType.rest);
            rval.add(asb);
            return rval;
        }

        /**
         * @see io.apiman.manager.api.core.IApiCatalog#getNamespaces(java.lang.String)
         */
        @Override
        public List<ApiNamespaceBean> getNamespaces(String currentUser) {
            List<ApiNamespaceBean> rval = new ArrayList<>();
            ApiNamespaceBean bean = new ApiNamespaceBean();
            bean.setCurrent(true);
            bean.setName("current");
            bean.setOwnedByUser(true);
            rval.add(bean);
            bean = new ApiNamespaceBean();
            bean.setCurrent(false);
            bean.setName("ns1");
            bean.setOwnedByUser(true);
            rval.add(bean);
            bean = new ApiNamespaceBean();
            bean.setCurrent(false);
            bean.setName("ns2");
            bean.setOwnedByUser(false);
            rval.add(bean);
            bean = new ApiNamespaceBean();
            bean.setCurrent(false);
            bean.setName("ns3");
            bean.setOwnedByUser(false);
            rval.add(bean);
            return rval;
        }
    };
}
Also used : ApiNamespaceBean(io.apiman.manager.api.beans.summary.ApiNamespaceBean) IApiCatalog(io.apiman.manager.api.core.IApiCatalog) ArrayList(java.util.ArrayList) AvailableApiBean(io.apiman.manager.api.beans.summary.AvailableApiBean) Produces(javax.enterprise.inject.Produces) ApplicationScoped(javax.enterprise.context.ApplicationScoped)

Aggregations

ApiNamespaceBean (io.apiman.manager.api.beans.summary.ApiNamespaceBean)1 AvailableApiBean (io.apiman.manager.api.beans.summary.AvailableApiBean)1 IApiCatalog (io.apiman.manager.api.core.IApiCatalog)1 ArrayList (java.util.ArrayList)1 ApplicationScoped (javax.enterprise.context.ApplicationScoped)1 Produces (javax.enterprise.inject.Produces)1