Package jeeves.server.local

Examples of jeeves.server.local.LocalServiceRequest


        if (remoteFragment == null) {
            Log.info(Log.XLINK_PROCESSOR, "cache MISS on "+uri.toLowerCase());

            try {
                if(uri.startsWith(XLink.LOCAL_PROTOCOL)) {
                    LocalServiceRequest request = LocalServiceRequest.create(uri.replaceAll("&", "&"));
                    request.setDebug(false);
                    if(request.getLanguage() == null) {
                        request.setLanguage(srvContext.getLanguage());
                    }
                    request.setInputMethod(InputMethod.GET);
                    remoteFragment = srvContext.execute(request);
                } else {
                    URL url = new URL(uri.replaceAll("&", "&"));

                    URLConnection conn = url.openConnection();
View Full Code Here


    public void testDispatchRequireTransaction() throws Exception {
        long count = _harvesterSettingRepo.count();
        TransactionlessTesting.get().run(new TestTask() {
            @Override
            public void run() throws Exception {
                LocalServiceRequest req = LocalServiceRequest.create("http://localhost/geonetwork/srv/eng/" + SERVICE_NAME);
                UserSession userSession = new UserSession();

                _service.setService(new ServiceFunction() {
                    @Override
                    public Element exec(Element params, ServiceContext context) throws Exception {
                        saveParentAndChildHarvesterSetting(context);

                        return new Element("ok");
                    }
                });

                _serviceManager.dispatch(req, userSession);

                final String resultString = req.getResultString();

                assertTrue(resultString.contains("ok"));
            }
        });
View Full Code Here

    public void testRollbackOnError() throws Exception {
        long count = _harvesterSettingRepo.count();
        TransactionlessTesting.get().run(new TestTask() {
            @Override
            public void run() throws Exception {
                LocalServiceRequest req = LocalServiceRequest.create("http://localhost/geonetwork/srv/eng/" + SERVICE_NAME);
                UserSession userSession = new UserSession();

                _service.setService(new ServiceFunction() {
                    @Override
                    public Element exec(Element params, ServiceContext context) throws Exception {
                        saveParentAndChildHarvesterSetting(context);
                        throw new Exception("test exception");
                    }
                });

                _serviceManager.dispatch(req, userSession);

                final String resultString = req.getResultString();

                assertTrue(resultString.contains("error"));
            }
        });
        assertEquals(count, _harvesterSettingRepo.count());
View Full Code Here

    public HealthCheck create(final ServiceContext context) {
        return new HealthCheck("Csw GetCapabilities") {
            @Override
            protected Result check() throws Exception {
                try {
          LocalServiceRequest request = LocalServiceRequest.create("local://csw?request=GetCapabilities&service=CSW");
          request.setDebug(false);
          request.setLanguage("eng");
          request.setInputMethod(InputMethod.GET);
          Element result = context.execute(request);

                    if (result.getChild("ServiceIdentification", Geonet.Namespaces.OWS) == null)
                        return Result.unhealthy("Capabilities did not have a 'ServiceIdentification' element as expected.  Xml: " + Xml.getString(result));
                    return Result.healthy();
View Full Code Here

    public HealthCheck create(final ServiceContext context) {
        return new HealthCheck("Csw GetRecords") {
            @Override
            protected Result check() throws Exception {
                try {
          LocalServiceRequest request = LocalServiceRequest.create("local://csw?request=GetRecords&service=CSW&MaxRecords=1&constraintlanguage=FILTER&version=2.0.2&resulttype=results");
          request.setDebug(false);
          request.setLanguage("eng");
          request.setInputMethod(InputMethod.GET);
          Element result = context.execute(request);

                    if (result.getChild("SearchResults", Csw.NAMESPACE_CSW) == null)
                        return Result.unhealthy("GetRecords request did not contain a SearchResults Element as Expected.  Xml = " + Xml.getString(result));
                    return Result.healthy();
View Full Code Here

TOP

Related Classes of jeeves.server.local.LocalServiceRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.