Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.JuRuntimeException


      url = JuUrl.resource().relativeTo(this.getTestClass()).get(actualResource);
      if (url == null) url = JuUrl.resource(actualResource);
    }
   
    if (url == null) {
      throw new JuRuntimeException(String.format("Couldn't find resource %s, relative to class %s"
          , actualResource
          , this.getTestClass()));
    }
   
    return url;
View Full Code Here


          break;
        }
      }
     
      if (cause != null) {
        throw new JuRuntimeException(causes.toString(), cause);
      } else {
        causes.addLine("Check Server log for more details");
        throw new JuRuntimeException(causes.toString());
      }
    } else {
      throw t;
    }
  }
View Full Code Here

        logger.debug("Creating RemoteServiceLocator [host={}:{}, app={} / module={}"
            , new Object[] {this.host, this.port, this.appName, this.moduleName});
       
        return new RemoteServiceLocatorImpl(ctx, this.appName, this.moduleName);
      } catch (Exception ex) {
        throw new JuRuntimeException("Couldn't create ServiceLocator", ex);
      }
    }
View Full Code Here

        @SuppressWarnings("unchecked")
        T obj = (T) this.ctx.lookup(absoluteJndiName);
       
        return obj;
      } catch (Exception ex) {
        throw new JuRuntimeException(ex);
      }
    }
View Full Code Here

   
    private static Context createInitialContext() {
      try {
        return new InitialContext();
      } catch (Exception ex) {
        throw new JuRuntimeException("Couldn't create InitialContext", ex);
      }
    }
View Full Code Here

    @Override
    public <T> T cdi(Class<T> clazz) {
      Set<Bean<?>> beans = this.bm.getBeans(clazz);
      List<T> instances = this.getInstances(beans, clazz);
      if (instances.size() != 1) {
        throw new JuRuntimeException("Expected exactly one result for CDI lookup of %s, but found %d", clazz, instances.size());
      } else {
        return instances.get(0);
      }
    }
View Full Code Here

   
    if (createParentDirectories) {
      try {
        Files.createDirectories(localPath.getParent());
      } catch (IOException ex) {
        throw new JuRuntimeException("Couldn't create parent directories", ex);
      }
    }
   
    return localPath;
  }
View Full Code Here

                      try {
                        @SuppressWarnings("unchecked")
                        T t = (T) factoryMethod.invoke(factory, (Object[])null);
                        return t;
                      } catch (Exception ex) {
                        throw new JuRuntimeException("Couldn't invoke method " + factoryMethod, ex);
                      }
                    }
                    @Override
                    public String toString() {
                      return factoryMethod.toString();
                    }
                  });
            }
          }
        }
      } else {
        if (clazz.isAssignableFrom(simulatable.getClass())) {
          @SuppressWarnings("unchecked")
          final T type = (T)simulatable;
         
          this.addType(clazz
              , implementations
              , type.getClass().getAnnotation(DynamicCdiTag.class)
              , new TypeCreator<T>() {
                @Override
                public T createType() {
                  return type;
                }
                @Override
                public String toString() {
                  return type.getClass().getName();
                }
              });
        }
      }
    }
   
    if (implementations.containsKey(tagName)) {
      logger.debug("Returning intance by tag match: {}", implementations.get(tagName));
      return implementations.get(tagName).createType();
    } else if (implementations.containsKey(defaultTagName)) {
      logger.debug("Returning default instance: {}", implementations.get(defaultTagName));
      return implementations.get(defaultTagName).createType();
    } else {
      throw new JuRuntimeException(String.format("No dynamic implementation found for %s and tagName=%s or defaultTagName=%s",
        clazz.getName(), tagName, defaultTagName));
    }
  }
View Full Code Here

    String tagValue = tag != null ? tag.value() : "-";
   
    logger.debug("Found implementation: {} (tag={})", typeCreator.toString(), tagValue);
   
    if (implementations.containsKey(tagValue)) {
      throw new JuRuntimeException(String.format(
          "Found two Simulatable implementations for %s and tag=%s: %s and %s (more might exist)",
          clazz.getName(), tagValue, implementations.get(tagValue).toString(), typeCreator.toString()));
    } else {
      implementations.put(tagValue, typeCreator);
    }
View Full Code Here

      SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
      Schema schema = schemaFactory.newSchema(url);

      return schema;
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't load XML schema: " + url, ex);
    }
  }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.JuRuntimeException

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.