Build a mock tango db

@param devices
@param classes
430917
public static void setNoDbDevices(final String[] devices, final String className) {
        DatabaseFactory.useDb = false;
        DatabaseFactory.fileDatabase = new FileTangoDB(Arrays.copyOf(devices, devices.length), className);
    }
634907
public DbAttribute[] get_class_attribute_property(String classname, String[] attnames) throws DevFailed {
		return databaseDAO.get_class_attribute_property(this, classname, attnames);
	}
215604
private void createTheServer(Database database) throws DevFailed {
        ArrayList<DbDevInfo>    deviceInfoList =new ArrayList<DbDevInfo>();
        for (TangoClass clazz : classes) {
            for (TangoDevice device : clazz) {
                deviceInfoList.add(new DbDevInfo(device.name, clazz.name, serverName));
            }
        }
        DbDevInfo[] deviceInfoArray = new DbDevInfo[deviceInfoList.size()];
        for (int i=0 ; i<deviceInfoList.size() ; i++) {
            deviceInfoArray[i] = deviceInfoList.get(i);
        }
        database.add_server(serverName, deviceInfoArray);
    }
1345805
private void init() {

		factories.put(NotEmptyQuery.class,     new NotEmptyQueryFactory(this));
		factories.put(FulltextQuery.class,     new KeywordQueryFactory(this));
		factories.put(SpatialQuery.class,      new SpatialQueryFactory(this));
		factories.put(GroupQuery.class,        new GroupQueryFactory(this));
		factories.put(RangeQuery.class,        new RangeQueryFactory(this));
		factories.put(ExactQuery.class,        new KeywordQueryFactory(this));
		factories.put(ArrayQuery.class,        new ArrayQueryFactory(this));
		factories.put(EmptyQuery.class,        new EmptyQueryFactory(this));
		factories.put(TypeQuery.class,         new TypeQueryFactory(this));
		factories.put(UuidQuery.class,         new UuidQueryFactory(this));
		factories.put(RelationshipQuery.class, new RelationshipQueryFactory(this));
		factories.put(ComparisonQuery.class,   new ComparisonQueryFactory(this));

		converters.put(Boolean.class, new BooleanTypeConverter());
		converters.put(String.class,  new StringTypeConverter());
		converters.put(Date.class,    new DateTypeConverter());
		converters.put(Long.class,    new LongTypeConverter());
		converters.put(Short.class,   new ShortTypeConverter());
		converters.put(Integer.class, new IntTypeConverter());
		converters.put(Float.class,   new FloatTypeConverter());
		converters.put(Double.class,  new DoubleTypeConverter());
		converters.put(byte.class,    new ByteTypeConverter());
	}
608014
private synchronized void add(final String... attributes) throws DevFailed {
        userAttributesNames = new String[attributes.length];
        devices = new DeviceProxy[attributes.length];
        int i = 0;
        for (final String attributeName : attributes) {
            final String deviceName = TangoUtil.getfullDeviceNameForAttribute(attributeName)
                    .toLowerCase(Locale.ENGLISH);
            final String fullAttribute = TangoUtil.getfullAttributeNameForAttribute(attributeName).toLowerCase(
                    Locale.ENGLISH);
            userAttributesNames[i] = fullAttribute;
            try {
                final DeviceProxy device = ProxyFactory.getInstance().createDeviceProxy(deviceName);
                devices[i++] = device;
                if (!devicesMap.containsKey(deviceName)) {
                    devicesMap.put(deviceName, device);
                }
            } catch (final DevFailed e) {
                if (throwExceptions) {
                    throw e;
                } else {
                    devices[i++] = null;
                    if (!devicesMap.containsKey(deviceName)) {
                        devicesMap.put(deviceName, null);
                    }
                }
            }
            final String attribute = fullAttribute.split("/")[3];
            if (!attributesMap.containsKey(deviceName)) {
                final List<String> attributesNames = new ArrayList<String>();
                attributesNames.add(attribute);
                attributesMap.put(deviceName, attributesNames);
            } else {
                attributesMap.get(deviceName).add(attribute);
            }
        }
    }
964276
public void setDevices(java.util.Collection<Device> devices) {
        if (devices == null) {
            this.devices = null;
            return;
        }

        this.devices = new java.util.ArrayList<Device>(devices);
    }
738365
function mockDB() {
  if (!mocked) {
    defaultController = Parse.CoreManager.getRESTController();
    mocked = true;
    Parse.CoreManager.setRESTController(MockRESTController);
  }
}
743243
private void addClasses(Class<?>[] classes, HashSet<Class<?>> result, String fieldName){
		
		if(classes == null || classes.length==0)	
			Error.classesAbsent(fieldName, configuredClass);
		
		for (Class<?> classe : classes)	result.add(classe);
	}
378805
private void configureNoDBFile(final String argv[], final String arg, final List<String> noDbDevices)
            throws DevFailed {
        if (!ArrayUtils.contains(argv, NODB)) {
            throw DevFailedUtils.newDevFailed(INIT_ERROR, getUsage());
        } else {
            final String name = arg.split("=")[1];
            final File file = new File(name);
            if (!file.exists() && !file.isFile()) {
                throw DevFailedUtils.newDevFailed(INIT_ERROR, name + " does not exists or is not a file");
            }
            logger.warn("Tango Database is not used - with file {} ", file.getPath());
            DatabaseFactory.setDbFile(file, noDbDevices.toArray(new String[0]), lastClass);
        }

    }
136220
public void setDBInstances(java.util.Collection<DBInstance> dBInstances) {
        if (dBInstances == null) {
            this.dBInstances = null;
            return;
        }

        this.dBInstances = new com.amazonaws.internal.SdkInternalList<DBInstance>(dBInstances);
    }
785116
public GetDevicesInPlacementResult withDevices(java.util.Map<String, String> devices) {
        setDevices(devices);
        return this;
    }
546001
public void addTangoUserListener(ITangoUserListener listener, String attrName, String[] filters, boolean stateless)
            throws DevFailed {
        TangoUser tangoUser;
        String key = deviceName+"/"+attrName;
        if ((tangoUser = tango_user_source.get(key)) == null) {
            tangoUser = new TangoUser(deviceProxy, attrName, filters);
            tango_user_source.put(key, tangoUser);
        }

        synchronized (moni) {
            tangoUser.addTangoUserListener(listener, stateless);
        }
    }
722562
@SuppressWarnings("unchecked")
    public <T> List<T> getDevices(final Class<T> type) {
        final List<W1Device> allDevices = getDevices();
        final List<T> filteredDevices = new ArrayList<>();
        for (final W1Device device : allDevices) {
            if (type.isAssignableFrom(device.getClass())) {
                filteredDevices.add((T) device);
            }
        }
        return filteredDevices;
    }
71335
<T extends EventListener> ArrayList<EventListener> getListeners(Class<T> type) {
        ArrayList<EventListener>    listeners = new ArrayList<EventListener>();
        for (TangoListener tangoListener : tangoListeners) {
            if (tangoListener.type==type) {
                listeners.add(tangoListener.listener);
            }
        }
        return listeners;
    }
815822
public void remove(String tangoHost) throws DevFailed {

        //  Remove device and class in reverse order,
		//	to remove the DServer as last one.
        //  If a failure append during this method,
        //	the server will be able to reloaded.
        Database    database = ApiUtil.get_db_obj(tangoHost);
        for (int i=classes.size()-1 ; i>=0 ; i--) {
            for (TangoDevice device : classes.get(i)) {
                database.delete_device(device.name);
            }
        }

        //  Check if there is other instance(s) of classes
        for (TangoClass clazz : classes) {
            if (!clazz.name.toLowerCase().equals("dserver")) { //   NOT for DServer class
                String[]    deviceNames = database.get_device_name("*", clazz.name);
                if (deviceNames.length==0) {
                    //  There is no device any more --> remove class properties
                    clazz.removeProperties(database);
                    //System.out.println("Class properties removed for " + clazz.name);
                }
                else {
                    //System.out.println(clazz.name + " class is used. do not delete Class properties");
                }
            }
        }
    }
1008034
public void addTangoPipeListener(ITangoPipeListener listener,
                                     String attrName, String[] filters, boolean stateless) throws DevFailed {
        TangoPipe tangoPipe;
        String key = deviceName+"/"+attrName;
        if ((tangoPipe = tango_pipe_source.get(key)) == null) {
            tangoPipe = new TangoPipe(deviceProxy, attrName, filters);
            tango_pipe_source.put(key, tangoPipe);
        }

        synchronized (moni) {
            tangoPipe.addTangoPipeListener(listener, stateless);
        }
    }
731344
public String[] get_class_attribute_list(Database database, String classname, String wildcard) throws DevFailed {
        if (!database.isAccess_checked()) checkAccess(database);

        DeviceData argIn = new DeviceData();
        argIn.insert(ApiUtil.toStringArray(classname, wildcard));
        DeviceData argOut = command_inout(database, "DbGetClassAttributeList", argIn);
        return argOut.extractStringArray();
    }