@Test public void saveInstanceFile() { Boolean aBoolean = redisMsInstFileService.saveInstanceFile(tacInst, devMsInstFileService.getInstanceFile(tacInst.getMsCode())); assertTrue(aBoolean); }
@Override public Boolean saveInstanceFile(TacInst tacInst, byte[] data) { String jarVersion; if (this.prePublish) { jarVersion = tacInst.getPrePublishJarVersion(); } else { jarVersion = tacInst.getJarVersion(); } if (StringUtils.isEmpty(jarVersion)) { throw new IllegalArgumentException("jarVersion"); } long instId = tacInst.getId(); if (instId <= 0) { throw new IllegalArgumentException("instId"); } if (data == null) { throw new IllegalArgumentException("data is null"); } String dataPath = getDataPath(instId, null); JSONObject metaData = new JSONObject(); metaData.put("jarVersion", jarVersion); fileDataMetaOperations.set(dataPath, metaData); dataPath = getDataPath(instId, jarVersion); String finalDataPath = dataPath; redisTemplate.execute(new RedisCallback<Object>() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.set(keySerializer.serialize(finalDataPath), data); return null; } }); return true; }
RedisMsInstFileService implements IMsInstFileService { @Override public Boolean saveInstanceFile(TacInst tacInst, byte[] data) { String jarVersion; if (this.prePublish) { jarVersion = tacInst.getPrePublishJarVersion(); } else { jarVersion = tacInst.getJarVersion(); } if (StringUtils.isEmpty(jarVersion)) { throw new IllegalArgumentException("jarVersion"); } long instId = tacInst.getId(); if (instId <= 0) { throw new IllegalArgumentException("instId"); } if (data == null) { throw new IllegalArgumentException("data is null"); } String dataPath = getDataPath(instId, null); JSONObject metaData = new JSONObject(); metaData.put("jarVersion", jarVersion); fileDataMetaOperations.set(dataPath, metaData); dataPath = getDataPath(instId, jarVersion); String finalDataPath = dataPath; redisTemplate.execute(new RedisCallback<Object>() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.set(keySerializer.serialize(finalDataPath), data); return null; } }); return true; } }
RedisMsInstFileService implements IMsInstFileService { @Override public Boolean saveInstanceFile(TacInst tacInst, byte[] data) { String jarVersion; if (this.prePublish) { jarVersion = tacInst.getPrePublishJarVersion(); } else { jarVersion = tacInst.getJarVersion(); } if (StringUtils.isEmpty(jarVersion)) { throw new IllegalArgumentException("jarVersion"); } long instId = tacInst.getId(); if (instId <= 0) { throw new IllegalArgumentException("instId"); } if (data == null) { throw new IllegalArgumentException("data is null"); } String dataPath = getDataPath(instId, null); JSONObject metaData = new JSONObject(); metaData.put("jarVersion", jarVersion); fileDataMetaOperations.set(dataPath, metaData); dataPath = getDataPath(instId, jarVersion); String finalDataPath = dataPath; redisTemplate.execute(new RedisCallback<Object>() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.set(keySerializer.serialize(finalDataPath), data); return null; } }); return true; } RedisMsInstFileService(Boolean prePublish); }
RedisMsInstFileService implements IMsInstFileService { @Override public Boolean saveInstanceFile(TacInst tacInst, byte[] data) { String jarVersion; if (this.prePublish) { jarVersion = tacInst.getPrePublishJarVersion(); } else { jarVersion = tacInst.getJarVersion(); } if (StringUtils.isEmpty(jarVersion)) { throw new IllegalArgumentException("jarVersion"); } long instId = tacInst.getId(); if (instId <= 0) { throw new IllegalArgumentException("instId"); } if (data == null) { throw new IllegalArgumentException("data is null"); } String dataPath = getDataPath(instId, null); JSONObject metaData = new JSONObject(); metaData.put("jarVersion", jarVersion); fileDataMetaOperations.set(dataPath, metaData); dataPath = getDataPath(instId, jarVersion); String finalDataPath = dataPath; redisTemplate.execute(new RedisCallback<Object>() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.set(keySerializer.serialize(finalDataPath), data); return null; } }); return true; } RedisMsInstFileService(Boolean prePublish); @PostConstruct void init(); @Override byte[] getInstanceFile(long instId); @Override Boolean saveInstanceFile(TacInst tacInst, byte[] data); }
RedisMsInstFileService implements IMsInstFileService { @Override public Boolean saveInstanceFile(TacInst tacInst, byte[] data) { String jarVersion; if (this.prePublish) { jarVersion = tacInst.getPrePublishJarVersion(); } else { jarVersion = tacInst.getJarVersion(); } if (StringUtils.isEmpty(jarVersion)) { throw new IllegalArgumentException("jarVersion"); } long instId = tacInst.getId(); if (instId <= 0) { throw new IllegalArgumentException("instId"); } if (data == null) { throw new IllegalArgumentException("data is null"); } String dataPath = getDataPath(instId, null); JSONObject metaData = new JSONObject(); metaData.put("jarVersion", jarVersion); fileDataMetaOperations.set(dataPath, metaData); dataPath = getDataPath(instId, jarVersion); String finalDataPath = dataPath; redisTemplate.execute(new RedisCallback<Object>() { @Override public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.set(keySerializer.serialize(finalDataPath), data); return null; } }); return true; } RedisMsInstFileService(Boolean prePublish); @PostConstruct void init(); @Override byte[] getInstanceFile(long instId); @Override Boolean saveInstanceFile(TacInst tacInst, byte[] data);  }